Thursday, September 30, 2010

Create a simple program with C language

At this opportunity, i will start writing articles about how to make a simple program with C language. Today i will give the script the program calculates the area of the triangle.
Note carefully script the following program:


/****************************************************************************
 * Name Programmers  :  Hendro P. Sinaga                                   *
 * File Name                 :  broadtriangular.c                                    *
 * Preparation Program :  30 September 2010                                 *
 * Program Objectives  :  Calculate the area of a triangle                  *
 ****************************************************************************/

#include

int main()
{
    float wide, the base, high;


    printf ("Calculate the area of triangle. \n");
    printf("Give length of the base: ");
    scanf("%f", &base);
    printf("Give a high triangle: ");
    scanf("%f", &high);
    wide = (the base * high) / 2.0;
    printf("Triangle area = %f\n", wide);
    return 0;
}

Hopefully the script of this program is useful for gentlemen in learning to make a simple program with C language.

No comments:

Post a Comment