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

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 *