c-programs-basics
This c program will find out the area and circumference of a circle by taking the radius of the circle as an input value from the user. We can also perform the program using the function.

C Program To Find Area And Perimeter Of Circle

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

#define PI 3.141

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

 printf("\n Enter The Radius : ");
 scanf("%f",&r);

 a=PI*r*r; //area of circle formula
 c=2*PI*r; //circumference of circle formula

 printf("\n Area of circle = %0.2f units/sq",a);
 printf("\n\n Circumference Of circle = %0.2f units",c);

 getch();
}

Output : 

Output : Area And Circumference Of Circle







In the above program, we have used the following formulas.
  1. Area Of Circle   A= π * r * r 
  2. Circumference Of Circle   C = 2 * π * r
     (Here PI(π) is constant and is equal to 3.141.)
C Program To Calculate Area And Circumference Of Circle Using Function

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

#define PI 3.141

float area(float n);
float peri(float m);

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

 printf("\n Enter The Radius : ");
 scanf("%f",&r);
 
 a=area(r); //area of circle formula
 c=peri(r); //circumference of circle formula

 printf("\n Area of circle = %0.2f units/sq",a);
 printf("\n\n Circumference Of circle = %0.2f units",c);

 getch();
}

float area(float n)
{
  return(PI*n*n);
}

float peri(float m)
{
 return(2*PI*m);
}
In this way, we can find the area and perimeter of a circle using this simple method in c programming.