C Programs to Find the Area of a Circle

C Programs to Find the Area of a Circle

C program to find the area of a circle; Through this tutorial, we will learn how to find or calculate the area of a circle using formula, function, and poiter in c programs.

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 following 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

Recommended C Programs

AuthorAdmin

My name is Devendra Dode. I am a full-stack developer, entrepreneur, and owner of Tutsmake.com. I like writing tutorials and tips that can help other developers. I share tutorials of PHP, Python, Javascript, JQuery, Laravel, Livewire, Codeigniter, Node JS, Express JS, Vue JS, Angular JS, React Js, MySQL, MongoDB, REST APIs, Windows, Xampp, Linux, Ubuntu, Amazon AWS, Composer, SEO, WordPress, SSL and Bootstrap from a starting stage. As well as demo example.

Leave a Reply

Your email address will not be published. Required fields are marked *