C Program to calculate area and circumference of circle

C Program to calculate area and circumference of circle, Write a c program to calculate area and circumference of the circle. ,

Write a program to calculate area and circumference of a circle where radius of a circle is imputed and define pi as constant.

Write a c program to calculate area and circumference of the circle.

C Code


#include<stdio.h>
#include<conio.h>
#define pi 3.14

void main()
{
  int r;
  float a, c;

  printf("\n\tenter value of radius=");
  scanf("%d",&r);

  a= pi*r*r;
  c=2*pi*r;

  printf("\tArea = %.2f\n",a);
  printf("\tCircumference = %.2f\n",c);

  getch();

}

Output

calculate area and circumference of circle

You can also perform this calculate by defining pi as float value. 

C Code


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

void main()
{
  int r;
  float a, c;
  float pi=3.14;

  printf("\n\tenter value of radius=");
  scanf("%d",&r);

  a= pi*r*r;
  c=2*pi*r;

  printf("\tArea = %.2f\n",a);
  printf("\tCircumference = %.2f\n",c);

  getch();

}

Output

calculate area and circumference of circle

You can also perform this calculation by putting value 

C Code



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

void main()
{
  int r;
  float a, c;

  printf("\n\tenter value of radius=");
  scanf("%d",&r);

  a= 3.14*r*r;
  c=2*3.14*r;

  printf("\tArea = %.2f\n",a);
  printf("\tCircumference = %.2f\n",c);

  getch();

}

You May Also Like...

Socialize with Us