Professional Documents
Culture Documents
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("enter the value of length and breath of the rectangle\n");
scanf("%d %d",&l, &b);
printf("\nEnter the value of radius of circle\n");
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 =%d\n\n", a);
printf("perimeter of the rectangle =%d\n\n", peri);
printf("Area of a circle =%f\n\n", areac);
printf("circumference of circle =%f\n\n", circ);
return 0;
}
Flowchart 2.2
C program 2.2 :
#include<stdio.h>
int main()
scanf("%f",&fah);
cel=(fah-32)*5/9;
return 0;
}
Flowchart 2.3
C program 2.3 :
#include<stdio.h>
int main()
int n;
float p, r, si;
scanf("%d",&n);
scanf("%f",&p);
scanf("%f",&r);
si=n*p*r/100;
return 0;
}
flowchart 2.4:
C Program 2.4:
#include<stdio.h>
int main()
scanf("%f",&r);
float vol=pi*r*r*r*4/3;
return 0;