Thursday, January 12, 2012

AREA OF TRIANGLE


#include<stdio.h>
#include<conio.h>
void main()
{
float b,h,area;
clrscr();
printf("Enter the base of the triangle: ");
scanf ("%f",&b);        //b stores the value of the base of the triangle
printf ("\nEnter the height of triangle: ");
scanf ("%f",&h);        //h stores the value of height
area=(b*h)/2;               //calculate the area and store it in variable area.
printf("\nThe area of triangle of \n base=%.2f \n height=%.2f is \n %.2f:",b,h,area);
getch();
}

No comments:

Post a Comment