Skip to main content

Area and Perimeter of a circle

#include <stdio.h>
#define pi 3.14  // defining pi=3.14
int main()
{
  float radius,area,perimeter;
  printf("Radius\t:\t");
  scanf("%f", &radius);
  area = pi*radius*radius;
  perimeter = 2*pi*radius;
  printf("\nArea\t\t:\t%.2f", area);
  printf("\nPerimeter\t:\t%.2f", perimeter);

  return 0;
}

Radius :  5

Area  : 78.50
Perimeter : 31.40 

Comments