FastFoodCoding

Login


Connect with one of the following accounts





Login

Please wait while we redirect...

Views: 35   



Following program shows you how to calculate trapezoid circumference.
This program gets trapezoid bases and sides from user and calculates circumference and prints it using following formula
Circumference = base1 + base2 + side1 +side2

#include <stdio.h>

int main(void) {
    float trapezoidBase1;
    float trapezoidBase2;
    float trapezoidSide1;
    float trapezoidSide2;

    printf("Please enter base1 of trapezoid:");
    scanf("%f", &trapezoidBase1);

    printf("Please enter base2 of trapezoid:");
    scanf("%f", &trapezoidBase2);

    printf("Please enter side1 of trapezoid:");
    scanf("%f", &trapezoidSide1);

    printf("Please enter side2 of trapezoid:");
    scanf("%f", &trapezoidSide2);

    float circumferenceOfTrapezoid =
        trapezoidBase1 + trapezoidBase2 + trapezoidSide1 + trapezoidSide2;

    printf("Circumference of trapezoid is: %f", circumferenceOfTrapezoid);
}

Output:

Please enter base1 of trapezoid: 20
Please enter base2 of trapezoid: 25
Please enter side1 of trapezoid: 32
Please enter side2 of trapezoid: 64
Circumference of trapezoid is: 141.000000



On By


Top Tutorials

Top Questions

Top Articles

Top Blogs

Top News