GTU PPS Program - 2

2.Write a program to find area of triangle using formula a = h*b*0.5.
where,
a - area of triangle
h - height of triangle and
b - length of base of triangle

#include<stdio.h>
#include<conio.h>
int main()
{
    float b,h,area;
    printf("\t\tProgram to find area of the triangle");
    printf("\n---------------------------------------");
    printf("\n\nenter length of base of triangle : ");
    scanf("%f",&b);
    printf("\nenter height of the triangle : ");
    scanf("%f",&h);
    area = 0.5*b*h;
    printf("\nArea of the triangle is %f",area);
    getch();
    return 0;
}

Sample output

Comments

YouTube

Popular posts from this blog

GTU PPS Program - 15

Vim Text Editor

GTU PPS Program - 11