C Program to find Area of a Parallelogram

Write a C Program to Find the Area of a Parallelogram with an example. The mathematical formula to find the Parallelogram area is base * height. This example allows entering a Parallelogram height, base and returns the area.

#include <stdio.h>

int main()
{
    float pgramBase, pgramHeight, pgramArea;
    
    printf("Enter the Parallelogram Base = ");
    scanf("%f",&pgramBase);

    printf("Enter the Parallelogram Height = ");
    scanf("%f",&pgramHeight);

    pgramArea = pgramBase * pgramHeight;

    printf("The Area of a Parallelogram = %.2f\n", pgramArea); 
    
    return 0;
}
C Program to find Area of a Parallelogram 1

C Program to Find the Area of a Parallelogram using functions.

#include <stdio.h>

float parallelogramArea(float pgramBase, float pgramHeight)
{
    return pgramBase * pgramHeight;
}

int main()
{
    float pgramBase, pgramHeight, pgramArea;
    
    printf("Enter the Base = ");
    scanf("%f",&pgramBase);

    printf("Enter the Height = ");
    scanf("%f",&pgramHeight);

    pgramArea = parallelogramArea(pgramBase, pgramHeight);

    printf("The Area = %.2f\n", pgramArea); 
    
    return 0;
}
Enter the Base = 22
Enter the Height = 17
The Area = 374.00

About Suresh

Suresh is the founder of TutorialGateway and a freelance software developer. He specialized in Designing and Developing Windows and Web applications. The experience he gained in Programming and BI integration, and reporting tools translates into this blog. You can find him on Facebook or Twitter.