C Program To Find Area Of SemiCircle

C Program To Find Area Of SemiCircle

C program to find Area Of SemiCircle; Through this tutorial, we will learn how to find or calculate area Of semiCircle using standard formula, function and pointer in c programs.

Programs and Algorithm to Find Area Of SemiCircle

Use the following algorithm and programs to find or calculate area Of semiCircle using standard formula, function, and pointer in c:

  • Algorithm to Find Area Of SemiCircle
  • C Program to Find Area Of SemiCircle using Standard Formula
  • C Program to Find Area Of SemiCircle using Function
  • C Program to Find Area Of SemiCircle using Pointer

Algorithm to Find Area Of SemiCircle

Use the following algorithm to write a program to find the area Of semiCircle; as follows:

  1. Take input radious. Store it in variable.
  2. Calculate area of semicircle using area=(22*r*r)/(2*7);
  3. Finally, print the value of area of semicircle.

C Program to Find Area Of SemiCircle using Standard Formula

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

The output of the above c program; as follows:

enter radius of the circle: 5
area of a semicircle: 39.000000

C Program to Find Area Of SemiCircle using Function

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

The output of the above c program; as follows:

enter radius of the semicircle: 8
area of a semicircle: 100.57142

C Program to Find Area Of SemiCircle using Pointer

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

The output of the above c program; as follows:

enter radius: 10
area of a semicircle: 157.14285

Recommended C Programs

AuthorAdmin

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 *