Search This Blog

Sep 23, 2013

C program to read base & altitude of a triangle & print its area

/* write a program to read fbase & altitude of a triangle & print its area */
#include<stdio.h>
#include<conio.h>
void main()
{
float b,h,a;
clrscr();
printf("Inter the Base of Trianfle:");
scanf("%f",&b);
printf("Inter the Height of Triangle:");
scanf("%f",&h);
a=((b*h)*1/2);
printf("\nArea of Triangle= %.2f",a);
getch();
}

No comments:

Post a Comment