C Program To Calculate Area of Triangle
/*******************************************************************
C program to calculate area of triangle. Assign base and height values
Formula: area=1/2 *height*base
*****************************************************************/
#include<stdio.h>
void main()
{
float
height=5.5;
float base=5.5;
float area;
area=0.5*height*base;
printf("The area of triangle
is:%f\n",area);
printf("End of program");
}
The area of triangle is:15.125000
End of program
/*******************************************************************
C program to calculate area of triangle. Take user input
Formula: area=1/2 *height*base
*****************************************************************/
#include<stdio.h>
#include<conio.h>
void main()
{
float height, base,area;
clrscr();
printf("Enter height and base of triangle\n");
scanf("%f%f",&height,&base);
area=0.5*height*base;
printf("The area of triangle
is:%f\n",area);
printf("End of program");
}
Enter height and base of triangle
5 5
The area of triangle is:12.500000
End of program
0 टिप्पण्या
कृपया तुमच्या प्रियजनांना लेख शेअर करा आणि तुमचा अभिप्राय जरूर नोंदवा. 🙏 🙏