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.


Here’s the list of Best Reference 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.

Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He is Linux Kernel Developer & SAN Architect and is passionate about competency developments in these areas. He lives in Bangalore and delivers focused training sessions to IT professionals in Linux Kernel, Linux Debugging, Linux Device Drivers, Linux Networking, Linux Storage, Advanced C Programming, SAN Storage Technologies, SCSI Internals & Storage Protocols such as iSCSI & Fiber Channel. Stay connected with him @ LinkedIn