C program to calculate area of right angle triangle

If you are using any software then below program will not give an error, but if you are using TURBO C then you have to make some changes like: void main() and some function like clrscr() or getch().

#include<stdio.h>
 main()
{
 int base,height;
 float area;

 printf("Enter the base of Right Angle Triangle : ");
 scanf("%d",&base);

 printf("\nEnter the height of Right Angle Triangle : ");
 scanf("%d",&height);

 area=0.5*base*height;
 printf("\nArea of Right Angle Triangle : %f",area);
}

OUTPUT:

Enter the base of Right Angle Triangle :5

Enter the height of Right Angle Triangle :8

Area of Right Angle Triangle : 20.000000

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.