Blogger templates

Pages

Monday, 7 May 2012

C Program: Enter the Radius of circle and Find out its Area and Perimeter

area and perimeter of circle

Statement of C program: Enter the radius of a circle and prints its 
  1. Area
  2. Perimeter
1. Area of Circle:

#include<stdio.h>
#include<conio.h>

void main()
{
float radius , area;              
float PI=3.142 ;
clrscr();

printf(" Enter the radius\n");
scanf("%f" , &radius);
area= PI * radius * radius ;
printf(" Area of circle=%f\n " , area);
printf(" Perimeter=%f\n" , pmeter);
getch();
}

Output:
Enter the radius
7
Area of circle= 154 44 44


2. Perimeter of Circle:

#include<stdio.h>
#include<conio.h>

void main()
{
float radius , pmeter;               // pmeter stands for perameter of circle.
float PI=3.142 ;
clrscr();
printf(" Enter the radius\n");
scanf("%f" , &radius);
pmeter = 2* PI * radius;
printf(" Area of circle=%f\n " , area);
printf(" Perimeter=%f\n" , pmeter);
getch();
}

Output:
Enter the radius
7
Perimeter of circle= 4444


0 comments:

Post a Comment