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

AuthorDevendra Dode

Greetings, I'm Devendra Dode, a full-stack developer, entrepreneur, and the proud owner of Tutsmake.com. My passion lies in crafting informative tutorials and offering valuable tips to assist fellow developers on their coding journey. Within my content, I cover a spectrum of technologies, including 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. Whether you're starting out or looking for advanced examples, I provide step-by-step guides and practical demonstrations to make your learning experience seamless. Let's explore the diverse realms of coding together.

Leave a Reply

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