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

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 *