C Program to Find Area of Parallelogram

This is a C Program to Find Area of Parallelogram.

Problem Description

This C Program calculates the area of Parallelogram.

Problem Solution

The formula used in this program are Area = b * a where b is the length of any base, a is the corresponding altitude.

Program/Source Code

Here is source code of the C Program to Find the area of Parallelogram. The C program is successfully compiled and run on a Linux system. The program output is also shown below.

 * C Program to Find Area of Parallelogram
#include <stdio.h>
int main()
    float base, altitude;
    float area;
    printf("Enter base and altitude of the given Parallelogram: \n ");
    scanf("%f%f", &base, &altitude);
    area = base * altitude;
    printf("Area of Parallelogram is: %.3f\n", area);
    return 0;
Program Explanation

In this C program, library function defined in <math.h> header file is used to compute mathematical functions. We are reading the ‘base’ and ‘altitude’ of a parallelogram. To find the surface area, the following formulas is used.


Area = base * altitude

Runtime Test Cases
$ cc pgm27.c
$ a.out
Enter base and altitude of the given Parallelogram:
 17 19
Area of Parallelogram is: 323.000

Sanfoundry Global Education & Learning Series – 1000 C Programs.

Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

Here’s the list of Best Books in C Programming, Data-Structures and Algorithms

If you wish to look at other example programs on Mathematical Functions, go to C Programming Examples on Mathematical Functions. If you wish to look at programming examples on all topics, go to C Programming Examples.

Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.