Tuesday, October 23, 2012

Calculation area of Trapezium

Name: Chea Lida
Major: TMD

#include <stdio.h> // stdio.h is the name of library that include printf and scanf function
#include <stdlib.h> //stdlib.h is the name of library that include system ("pause") function
int main(void) // Function who shall there is on each program c
{
    float a; // for small bottom of Trapezium
    float b; // for big bottom of Trapezium
    float h; // for height of Trapezium
    float area; // for area of Trapezium
   
    printf (" Please input small bottom of Trapezium: \n");
    scanf("%f",&a);
    printf ("Please input big bottom of Trapezium: \n");
    scanf("%f",&b);
    printf ("Please input height of Trapezium:");
    scanf ("%f",&h);
    area = ((a+b)*h)/2;
    printf ("Area of Trapezium is= %d\n",area);
    system("pause"); //to pause a program and wait for a keyboard input to continue.

}




http://www.youtube.com/watch?v=wBucl_jQJJk&feature=youtu.be


No comments:

Post a Comment