Pages

Labels

C Program to Calculate perimeter and area of circle

This program calculates the perimeter and area of circle


#include <stdio.h>
#include <math.h>
main ()
{
  float r, p, a;
  printf ("Enter the radius of Circle:");
  scanf ("%f", &r);
  p = 2 * 3.14 * r;
  a = 3.14 * r * r;
  printf ("The perimeter of circle is:%f\n", p);
  printf ("The area of circle is:%f\n", a);
  getch();
}


Output:--
Enter the radius of Circle: 2.5
The perimeter of circle is: 15.7
The area of circle is: 19.6

How it works
It asks for the radius of circle and calculates the perimeter and area of a circle by using circle formula

Followers