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 C 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 Parallelogram Base = ");
    scanf("%f",&pgramBase);

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

    pgramArea = parallelogramArea(pgramBase, pgramHeight);

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