Search Your C Program

Wednesday, 25 January 2012

Program to Calculate the Area of a Triangle

#include<stdio.h>
#include<conio.h>
void main()
{
int base,height;
float area;
clrscr(); // Function to clear the output screen
printf("Enter the base and height of the triangle : ");
scanf("%d %d",&base,&height);
area=0.5*base*height;
printf("The area of triangle with base %d and height %d is %f",base,height,area);
getch();
}

No comments:

Post a Comment