C Program to Find Area of a Parallelogram

C Program to Find Area of a Parallelogram

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

Programs and Algorithm to Find Area of a Parallelogram

Let’s follow the following algorithm and program to find or calculate area of a parallelogram using standard formula, function and pointer in c:

  • Algorithm to Find Area of a Parallelogram
  • C Program to Find Area of a Parallelogram using Formula
  • C Program to Find Area of a Parallelogram using Function
  • C Program to Find Area of a Parallelogram using Pointer

Algorithm to Find Area of a Parallelogram

Use the following algorithm to write a program to find the area of a parallelogram; as follows:

  1. Take input base and height of parallelogram. Store it in two different variables.
  2. Calculate area of parallelogram using perimeter=2*(length+breadth)
  3. Finally, print the value of area of parallelogram.

C Program to Find Area of a Parallelogram using Formula

#include<stdio.h>
int main()
{
	float base,height,area;
	printf("enter base of parallelogram: ");
	scanf("%f",&base);
	
	printf("enter height of the parallelogram: ");
	scanf("%f",&height);
	area=(base*height);
	printf("Area of parallelogram: %f\n",area);
	return 0;
}

The output of the above c program; as follows:

enter base of parallelogram: 10
enter height of the parallelogram: 30
Area of parallelogram: 300.000000

C Program to Find Area of a Parallelogram using Function

#include<stdio.h>
float area(float b,float h)
{
	return (b*h);
}
 
int main()
{
	float b,h,a;
	printf("enter base: ");
	scanf("%f",&b);
	
	printf("enter height: ");
	scanf("%f",&h);
	a=area(b,h);
	printf("Area of parallelogram: %f\n",a);
	return 0;
}

The output of the above c program; as follows:

enter base: 55
enter height: 63
Area of parallelogram: 3465.000000

C Program to Find Area of a Parallelogram using Pointer

#include<stdio.h>
void area(float *b,float *h,float *area)
{
	*area=((*b)*(*h));
}
 
int main()
{
	
 
	float b,h,a;
	printf("enter base: ");
	scanf("%f",&b);
	
	printf("enter height: ");
	scanf("%f",&h);
	area(&b,&h,&a);
	printf("Area of parallelogram: %f\n",a);
	return 0;
}

The output of the above c program; as follows:

enter base: 5
enter height: 63
Area of parallelogram: 315.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 *