WAP to calculate the area and circumference of a circle

WAP to calculate the area and circumference of a circle

Write a program to read the radius of a circle and to compute its area and circumference. Use a symbolic constant to define the value of π.

/* Write a program to read the radius of a circle and to compute its area and circumference. Use a symbolic constant to define the value of pie */

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

int main() {
  float a,c,r;
  printf("Enter the value of radius:\n");
  scanf("%f",&r);
  c = 2*pi*r;
  a = pi*r*r;
  printf("Circumference of circle is %.2f.\nArea of circle is %.2f.",c,a);
  getch();
  return 0;
}

Output

For a radius 5, circumference = 31.43 and area = 78.57

 

circle area and circumference

Also see, how you can convert temperature.

Share this post