C Programs to Find the Area of a Circle

In this tutorial, i am going to show you how to find or calculate the area of a circle with the help of standard formula, function, and poiter in c programs.

All C Programs and Algorithm to Find the Area of a Circle

  • Algorithm To Find Area Of a Circle
  • C Programs to Find the Area of a Circle using Formula
  • C Programs to Find the Area of a Circle using Function
  • C Programs to Find the Area of a Circle using Pointer

Algorithm To Find Area Of a Circle

Use the below given algorithm to write a program to find area of a circle; as follows:

  1. START PROGRAM.
  2. TAKE RADIUS AS INPUT FROM USER.
  3. FIND AREA OF A CIRLCE USING THIS FORMULA AREA=3.14*RADIUS*RADIUS.
  4. PRINT “AREA OF CIRCLE = “
  5. END PROGRAM.

C Programs to Find the Area of a Circle using Formula

#include<stdio.h>
int main()
{
	int r;
	float area;
	printf("Please enter radius of the circle: ");
	scanf("%d",&r);
	area=(22*r*r)/7;
	printf("The area of circle is: %f\n",area);
	return 0;
}

The output of the above c program; as follows:

Please enter radius of the circle: 15
The area of circle is: 707.000000

C Programs to Find the Area of a Circle using Function

#include<stdio.h>
float area(int r)
{
	return (22*r*r)/7;
}
int main()
{
	int r;
	float a;
	printf("Please enter radius of the circle: ");
	scanf("%d",&r);
        a=area(r); 
	printf("area of the circle: %f\n",a);
	return 0;
}

The output of the above c program; as follows:

Please enter radius of the circle: 5
area of the circle: 78.000000

C Programs to Find the Area of a Circle using Pointer

#include<stdio.h>
void area(int *r,float *a)
{
	*a=(22*(*r)*(*r))/7;
}
int main()
{
	int r;
	float a=1;
	printf("Please enter radius of the circle: ");
	scanf("%d",&r);
        area(&r,&a); 
	printf("The area of circle is: %f\n",a);
	return 0;
}

The output of the above c program; as follows:

Please enter radius of the circle: 7
The area of circle is: 154.000000

More C Programming Tutorials

Leave a Comment