Search



Monday, 16 February 2015

Area and Circumference of Circle

In this program, # is a preprocessor directive ,  whereas #include<filename.h> is used
to extract the functions already created in file .float r creates a float type variable
which stores radius given by user area of circle = 3.14*radius & radius & 
circumference of circle = 2*3.14*radius which are stored in ar & cir respectively .  


---------------------------------------------------------------------------------------------------------------------------------------------------------

Program for Area and Circumference of Circle.

#include<stdio.h>
#include<conio.h>
void main()
{ float ar,cir,r;
clrscr();
printf("\n program to calculate area & circumference of circle");
printf("\n\n enter radius of circle : ");
scanf("%f",&r);
ar = 3.14*r*r;
cir = 2*3.14*r;
printf("\n area of circle = %f",ar);
printf("\n circumference of circle = %f",cir);
getch();
}



No comments:

Post a Comment

Guys if you think something is wrong or should be edit than please do comment.