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 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