Ex.
No -1A,B(i) Area And Circumference of a Circle
Aim:
To develop a C program to find the area and circumference of a circle of given radius
Algorithm:
1. Start
2. Read r value
3. Define pi=3.14
4. area=pi*r*r
5. circumference=2*pi*r
6. Print area, circumference value
7. Stop
Flowchart:
Start
Read‘r’value
Area=pi*r*r
Circumference=2*pi*r
Print area and
circumference
Stop
Program:
#include<stdio.h>
#include<conio.h>
void main()
{ int rad;
float PI=3.14, area, ci;
clrscr();
printf("\nEnter radius of circle:");
scanf("%d", &rad);
area=PI* rad * rad;
printf("\n Area of circle :%f",area);
ci = 2 * PI * rad;
printf("\n Circumference:%f",ci);
getch();
}
Output:
Result:
The C program was executed successfully.
Ex.No -1A,B(ii) Volume of a Sphere
Aim:
To develop a C program to find the volume of a sphere of given radius.
Algorithm:
1. Start
2. Read r value
3. Define pi=3.14
4. volume=4/3*pi*r*r*r
6. Print volume
7. Stop
Flowchart:
Start
Read the Radius
Volume=4/3*pi*r*r*r
Print volume
Stop
Program:
*Source code to Find the volume of a sphere of given radius */
#include<stdio.h>
#include<conio.h>
void main(){
float vol;
int rad;
clrscr();
rad=scanf(“%d”,&rad);
vol=((4.0/3.0)*(3.1415)*rad*rad*rad);
printf("the volume of a sphere is %f",vol);
getch();
}
Output:
Result:
The C program was executed successfully.
Ex.No -1A,B(iii) Find the Simple Interest
Aim:
To develop a C program to find the interest on a given principle for a given period of
time at a given rate of interest per year
Algorithm:
1. Start
2. Read p,t,r values
3. si=(p*t*r)/100
6. Print si(Simple Interest) value
7. Stop
Flowchart:
Start
Read the
p,t,r,values
si=(p*t*r)/100
Print si value
Stop
Program:
*Source code to find the interest of a given principle for a given period of time at a
given rate of interest per year*/
#include<stdio.h>
#include<conio.h>
void main()
{
float principle, rate, sinterest;
int time;
clrscr();
printf("Enter Principle Amount, Rate per Annual and Time\n");
scanf ("%f %f %d", &principle, &rate, &time);
sinterest=(principle* rate*time)/ 100.0;
printf("PrincipleAmount=%5.2f\n",princple);
printf ("Rate per Annum= %5.2f\n",rate);
printf ("Time= %d years\n", time);
printf("SimpleInterest=%5.2f\n",sinterest);
getch();
}
Output:
Result:
The C program was executed successfully.