SlideShare a Scribd company logo
Roll No: B21600 Page no: 1
BASIC PROGRAMMING
CONSTRUCTURE
Exp no: 02 Date:26|10|2021
Aim: programs using the concept of variable, operators and datatypes
Theory:
Flowchart 2.1:
C program 2.1
#include<stdio.h>
int main()
{
int l, b, a, peri=0;
float radius,areac=0.0,circ=0.0;
//input
printf("enterthe value of length and breath of the rectanglen");
scanf("%d %d",&l,&b);
printf("nEnterthe value of radius of circlen");
scanf("%f",&radius);
//process
a=l*b;
peri=2*(l*b);
areac=3.14*radius*radius;
circ=2*3.14*radius;
//output
printf("nArea of the rectangle =%dnn",a);
printf("perimeter of the rectangle =%dnn",peri);
printf("Area of a circle =%fnn", areac);
printf("circumferenceof circle =%fnn", circ);
return 0;
}
Flowchart 2.2
C program 2.2 :
#include<stdio.h>
int main()
{
float fah, cel;
printf("Program to convertfahrenheitto celsiusn");
printf("Enter the Fahrenheitn");
scanf("%f",&fah);
cel=(fah-32)*5/9;
printf("Thecelcius is %f",cel);
return 0;
}
Flowchart 2.3
C program 2.3 :
#include<stdio.h>
int main()
{
int n;
float p, r, si;
printf("programeto find the simple interestn");
printf("enter the number ofyearsn");
//n stand for number of years
scanf("%d",&n);
printf("Enetr the principalamountn");
//p stand for principalamount
scanf("%f",&p);
printf("Enter the interestrate n");
//r stand for interestrate
scanf("%f",&r);
si=n*p*r/100;
printf("the simple interestis %f",si);
return 0;
}
flowchart 2.4:
C Program 2.4:
#include<stdio.h>
int main()
{
float r=0.0,pi=3.14;
printf("programeto find the volume of spheren");
printf("Enter the radius");
scanf("%f",&r);
float vol=pi*r*r*r*4/3;
printf("the volume of sphere %f",vol);
return 0;
}

More Related Content

Similar to 2.docx

Mathematics Function in C ,ppt
Mathematics Function in C ,pptMathematics Function in C ,ppt
Mathematics Function in C ,ppt
AllNewTeach
 
C programs
C programsC programs
C programs
Vikram Nandini
 
C PROGRAMS
C PROGRAMSC PROGRAMS
week-3x
week-3xweek-3x
Graphics practical lab manual
Graphics practical lab manualGraphics practical lab manual
Graphics practical lab manual
Vivek Kumar Sinha
 
chapter-6 slide.pptx
chapter-6 slide.pptxchapter-6 slide.pptx
chapter-6 slide.pptx
cricketreview
 
C Programming lab
C Programming labC Programming lab
C Programming lab
Vikram Nandini
 
Arithmetic operator
Arithmetic operatorArithmetic operator
Arithmetic operator
Md Masudur Rahman
 
C-programs
C-programsC-programs
C-programs
SSGMCE SHEGAON
 
EE201_Assignment2
EE201_Assignment2EE201_Assignment2
EE201_Assignment2
Khaled Mohammed
 
C Programming
C ProgrammingC Programming
C Programming
Sumant Diwakar
 
7 functions
7  functions7  functions
7 functions
MomenMostafa
 
A10presentationofbiologyandpshyology.pptx
A10presentationofbiologyandpshyology.pptxA10presentationofbiologyandpshyology.pptx
A10presentationofbiologyandpshyology.pptx
ranjangamer007
 
Lab manualsahu[et&amp;t]
Lab manualsahu[et&amp;t]Lab manualsahu[et&amp;t]
Lab manualsahu[et&amp;t]
Vivek Kumar Sinha
 
Muzzammilrashid
MuzzammilrashidMuzzammilrashid
Muzzammilrashid
muzzammilrashid
 
Pads lab manual final
Pads lab manual finalPads lab manual final
Pads lab manual final
AhalyaR
 
C programs Set 2
C programs Set 2C programs Set 2
C programs Set 2
Koshy Geoji
 
12
1212
9.C Programming
9.C Programming9.C Programming
9.C Programming
Export Promotion Bureau
 
Cs291 assignment solution
Cs291 assignment solutionCs291 assignment solution
Cs291 assignment solution
Kuntal Bhowmick
 

Similar to 2.docx (20)

Mathematics Function in C ,ppt
Mathematics Function in C ,pptMathematics Function in C ,ppt
Mathematics Function in C ,ppt
 
C programs
C programsC programs
C programs
 
C PROGRAMS
C PROGRAMSC PROGRAMS
C PROGRAMS
 
week-3x
week-3xweek-3x
week-3x
 
Graphics practical lab manual
Graphics practical lab manualGraphics practical lab manual
Graphics practical lab manual
 
chapter-6 slide.pptx
chapter-6 slide.pptxchapter-6 slide.pptx
chapter-6 slide.pptx
 
C Programming lab
C Programming labC Programming lab
C Programming lab
 
Arithmetic operator
Arithmetic operatorArithmetic operator
Arithmetic operator
 
C-programs
C-programsC-programs
C-programs
 
EE201_Assignment2
EE201_Assignment2EE201_Assignment2
EE201_Assignment2
 
C Programming
C ProgrammingC Programming
C Programming
 
7 functions
7  functions7  functions
7 functions
 
A10presentationofbiologyandpshyology.pptx
A10presentationofbiologyandpshyology.pptxA10presentationofbiologyandpshyology.pptx
A10presentationofbiologyandpshyology.pptx
 
Lab manualsahu[et&amp;t]
Lab manualsahu[et&amp;t]Lab manualsahu[et&amp;t]
Lab manualsahu[et&amp;t]
 
Muzzammilrashid
MuzzammilrashidMuzzammilrashid
Muzzammilrashid
 
Pads lab manual final
Pads lab manual finalPads lab manual final
Pads lab manual final
 
C programs Set 2
C programs Set 2C programs Set 2
C programs Set 2
 
12
1212
12
 
9.C Programming
9.C Programming9.C Programming
9.C Programming
 
Cs291 assignment solution
Cs291 assignment solutionCs291 assignment solution
Cs291 assignment solution
 

Recently uploaded

Tape Measure Training & Practice Assessments.pdf
Tape Measure Training & Practice Assessments.pdfTape Measure Training & Practice Assessments.pdf
Tape Measure Training & Practice Assessments.pdf
KateRobinson68
 
Gabrielle M. A. Sinaga Portfolio, Film Student (2024)
Gabrielle M. A. Sinaga Portfolio, Film Student (2024)Gabrielle M. A. Sinaga Portfolio, Film Student (2024)
Gabrielle M. A. Sinaga Portfolio, Film Student (2024)
GabrielleSinaga
 
Learnings from Successful Jobs Searchers
Learnings from Successful Jobs SearchersLearnings from Successful Jobs Searchers
Learnings from Successful Jobs Searchers
Bruce Bennett
 
lab.123456789123456789123456789123456789
lab.123456789123456789123456789123456789lab.123456789123456789123456789123456789
lab.123456789123456789123456789123456789
Ghh
 
A Guide to a Winning Interview June 2024
A Guide to a Winning Interview June 2024A Guide to a Winning Interview June 2024
A Guide to a Winning Interview June 2024
Bruce Bennett
 
在线制作加拿大萨省大学毕业证文凭证书实拍图原版一模一样
在线制作加拿大萨省大学毕业证文凭证书实拍图原版一模一样在线制作加拿大萨省大学毕业证文凭证书实拍图原版一模一样
在线制作加拿大萨省大学毕业证文凭证书实拍图原版一模一样
2zjra9bn
 
Resumes, Cover Letters, and Applying Online
Resumes, Cover Letters, and Applying OnlineResumes, Cover Letters, and Applying Online
Resumes, Cover Letters, and Applying Online
Bruce Bennett
 
一比一原版布拉德福德大学毕业证(bradford毕业证)如何办理
一比一原版布拉德福德大学毕业证(bradford毕业证)如何办理一比一原版布拉德福德大学毕业证(bradford毕业证)如何办理
一比一原版布拉德福德大学毕业证(bradford毕业证)如何办理
taqyea
 
0624.speakingengagementsandteaching-01.pdf
0624.speakingengagementsandteaching-01.pdf0624.speakingengagementsandteaching-01.pdf
0624.speakingengagementsandteaching-01.pdf
Thomas GIRARD BDes
 
Leave-rules.ppt CCS leave rules 1972 for central govt employees
Leave-rules.ppt CCS leave rules 1972 for central govt employeesLeave-rules.ppt CCS leave rules 1972 for central govt employees
Leave-rules.ppt CCS leave rules 1972 for central govt employees
Sreenivas702647
 
Job Finding Apps Everything You Need to Know in 2024
Job Finding Apps Everything You Need to Know in 2024Job Finding Apps Everything You Need to Know in 2024
Job Finding Apps Everything You Need to Know in 2024
SnapJob
 
BUKU PENJAGAAN BUKU PENJAGAAN BUKU PENJAGAAN
BUKU PENJAGAAN BUKU PENJAGAAN BUKU PENJAGAANBUKU PENJAGAAN BUKU PENJAGAAN BUKU PENJAGAAN
BUKU PENJAGAAN BUKU PENJAGAAN BUKU PENJAGAAN
cahgading001
 
labb123456789123456789123456789123456789
labb123456789123456789123456789123456789labb123456789123456789123456789123456789
labb123456789123456789123456789123456789
Ghh
 
Switching Careers Slides - JoyceMSullivan SocMediaFin - 2024Jun11.pdf
Switching Careers Slides - JoyceMSullivan SocMediaFin -  2024Jun11.pdfSwitching Careers Slides - JoyceMSullivan SocMediaFin -  2024Jun11.pdf
Switching Careers Slides - JoyceMSullivan SocMediaFin - 2024Jun11.pdf
SocMediaFin - Joyce Sullivan
 
thyroid case presentation.pptx Kamala's Lakshaman palatial
thyroid case presentation.pptx Kamala's Lakshaman palatialthyroid case presentation.pptx Kamala's Lakshaman palatial
thyroid case presentation.pptx Kamala's Lakshaman palatial
Aditya Raghav
 
IT Career Hacks Navigate the Tech Jungle with a Roadmap
IT Career Hacks Navigate the Tech Jungle with a RoadmapIT Career Hacks Navigate the Tech Jungle with a Roadmap
IT Career Hacks Navigate the Tech Jungle with a Roadmap
Base Camp
 
Leadership Ambassador club Adventist module
Leadership Ambassador club Adventist moduleLeadership Ambassador club Adventist module
Leadership Ambassador club Adventist module
kakomaeric00
 
5 Common Mistakes to Avoid During the Job Application Process.pdf
5 Common Mistakes to Avoid During the Job Application Process.pdf5 Common Mistakes to Avoid During the Job Application Process.pdf
5 Common Mistakes to Avoid During the Job Application Process.pdf
Alliance Jobs
 
Lbs last rank 2023 9988kr47h4744j445.pdf
Lbs last rank 2023 9988kr47h4744j445.pdfLbs last rank 2023 9988kr47h4744j445.pdf
Lbs last rank 2023 9988kr47h4744j445.pdf
ashiquepa3
 
How to Prepare for Fortinet FCP_FAC_AD-6.5 Certification?
How to Prepare for Fortinet FCP_FAC_AD-6.5 Certification?How to Prepare for Fortinet FCP_FAC_AD-6.5 Certification?
How to Prepare for Fortinet FCP_FAC_AD-6.5 Certification?
NWEXAM
 

Recently uploaded (20)

Tape Measure Training & Practice Assessments.pdf
Tape Measure Training & Practice Assessments.pdfTape Measure Training & Practice Assessments.pdf
Tape Measure Training & Practice Assessments.pdf
 
Gabrielle M. A. Sinaga Portfolio, Film Student (2024)
Gabrielle M. A. Sinaga Portfolio, Film Student (2024)Gabrielle M. A. Sinaga Portfolio, Film Student (2024)
Gabrielle M. A. Sinaga Portfolio, Film Student (2024)
 
Learnings from Successful Jobs Searchers
Learnings from Successful Jobs SearchersLearnings from Successful Jobs Searchers
Learnings from Successful Jobs Searchers
 
lab.123456789123456789123456789123456789
lab.123456789123456789123456789123456789lab.123456789123456789123456789123456789
lab.123456789123456789123456789123456789
 
A Guide to a Winning Interview June 2024
A Guide to a Winning Interview June 2024A Guide to a Winning Interview June 2024
A Guide to a Winning Interview June 2024
 
在线制作加拿大萨省大学毕业证文凭证书实拍图原版一模一样
在线制作加拿大萨省大学毕业证文凭证书实拍图原版一模一样在线制作加拿大萨省大学毕业证文凭证书实拍图原版一模一样
在线制作加拿大萨省大学毕业证文凭证书实拍图原版一模一样
 
Resumes, Cover Letters, and Applying Online
Resumes, Cover Letters, and Applying OnlineResumes, Cover Letters, and Applying Online
Resumes, Cover Letters, and Applying Online
 
一比一原版布拉德福德大学毕业证(bradford毕业证)如何办理
一比一原版布拉德福德大学毕业证(bradford毕业证)如何办理一比一原版布拉德福德大学毕业证(bradford毕业证)如何办理
一比一原版布拉德福德大学毕业证(bradford毕业证)如何办理
 
0624.speakingengagementsandteaching-01.pdf
0624.speakingengagementsandteaching-01.pdf0624.speakingengagementsandteaching-01.pdf
0624.speakingengagementsandteaching-01.pdf
 
Leave-rules.ppt CCS leave rules 1972 for central govt employees
Leave-rules.ppt CCS leave rules 1972 for central govt employeesLeave-rules.ppt CCS leave rules 1972 for central govt employees
Leave-rules.ppt CCS leave rules 1972 for central govt employees
 
Job Finding Apps Everything You Need to Know in 2024
Job Finding Apps Everything You Need to Know in 2024Job Finding Apps Everything You Need to Know in 2024
Job Finding Apps Everything You Need to Know in 2024
 
BUKU PENJAGAAN BUKU PENJAGAAN BUKU PENJAGAAN
BUKU PENJAGAAN BUKU PENJAGAAN BUKU PENJAGAANBUKU PENJAGAAN BUKU PENJAGAAN BUKU PENJAGAAN
BUKU PENJAGAAN BUKU PENJAGAAN BUKU PENJAGAAN
 
labb123456789123456789123456789123456789
labb123456789123456789123456789123456789labb123456789123456789123456789123456789
labb123456789123456789123456789123456789
 
Switching Careers Slides - JoyceMSullivan SocMediaFin - 2024Jun11.pdf
Switching Careers Slides - JoyceMSullivan SocMediaFin -  2024Jun11.pdfSwitching Careers Slides - JoyceMSullivan SocMediaFin -  2024Jun11.pdf
Switching Careers Slides - JoyceMSullivan SocMediaFin - 2024Jun11.pdf
 
thyroid case presentation.pptx Kamala's Lakshaman palatial
thyroid case presentation.pptx Kamala's Lakshaman palatialthyroid case presentation.pptx Kamala's Lakshaman palatial
thyroid case presentation.pptx Kamala's Lakshaman palatial
 
IT Career Hacks Navigate the Tech Jungle with a Roadmap
IT Career Hacks Navigate the Tech Jungle with a RoadmapIT Career Hacks Navigate the Tech Jungle with a Roadmap
IT Career Hacks Navigate the Tech Jungle with a Roadmap
 
Leadership Ambassador club Adventist module
Leadership Ambassador club Adventist moduleLeadership Ambassador club Adventist module
Leadership Ambassador club Adventist module
 
5 Common Mistakes to Avoid During the Job Application Process.pdf
5 Common Mistakes to Avoid During the Job Application Process.pdf5 Common Mistakes to Avoid During the Job Application Process.pdf
5 Common Mistakes to Avoid During the Job Application Process.pdf
 
Lbs last rank 2023 9988kr47h4744j445.pdf
Lbs last rank 2023 9988kr47h4744j445.pdfLbs last rank 2023 9988kr47h4744j445.pdf
Lbs last rank 2023 9988kr47h4744j445.pdf
 
How to Prepare for Fortinet FCP_FAC_AD-6.5 Certification?
How to Prepare for Fortinet FCP_FAC_AD-6.5 Certification?How to Prepare for Fortinet FCP_FAC_AD-6.5 Certification?
How to Prepare for Fortinet FCP_FAC_AD-6.5 Certification?
 

2.docx

  • 1. Roll No: B21600 Page no: 1 BASIC PROGRAMMING CONSTRUCTURE Exp no: 02 Date:26|10|2021 Aim: programs using the concept of variable, operators and datatypes Theory: Flowchart 2.1:
  • 2. C program 2.1 #include<stdio.h> int main() { int l, b, a, peri=0; float radius,areac=0.0,circ=0.0; //input printf("enterthe value of length and breath of the rectanglen"); scanf("%d %d",&l,&b); printf("nEnterthe value of radius of circlen"); scanf("%f",&radius); //process a=l*b; peri=2*(l*b); areac=3.14*radius*radius; circ=2*3.14*radius; //output printf("nArea of the rectangle =%dnn",a); printf("perimeter of the rectangle =%dnn",peri); printf("Area of a circle =%fnn", areac); printf("circumferenceof circle =%fnn", circ); return 0; }
  • 4. C program 2.2 : #include<stdio.h> int main() { float fah, cel; printf("Program to convertfahrenheitto celsiusn"); printf("Enter the Fahrenheitn"); scanf("%f",&fah); cel=(fah-32)*5/9; printf("Thecelcius is %f",cel); return 0; }
  • 6. C program 2.3 : #include<stdio.h> int main() { int n; float p, r, si; printf("programeto find the simple interestn"); printf("enter the number ofyearsn"); //n stand for number of years scanf("%d",&n); printf("Enetr the principalamountn"); //p stand for principalamount scanf("%f",&p); printf("Enter the interestrate n"); //r stand for interestrate scanf("%f",&r); si=n*p*r/100; printf("the simple interestis %f",si); return 0; }
  • 8. C Program 2.4: #include<stdio.h> int main() { float r=0.0,pi=3.14; printf("programeto find the volume of spheren"); printf("Enter the radius"); scanf("%f",&r); float vol=pi*r*r*r*4/3; printf("the volume of sphere %f",vol); return 0; }