To Find Area Of Triangle
To Find Area Of Triangle
#include<stdio.h> /*tells compiler to include std input output file.*/
#include<conio.h>/*tells compilers to provide console input/output*/
void main()
{
int height, base; /*declaring variables height and base*/
float ans; /*ans may come in fractions*/
clrscr(); /*it clear the screen*/
printf("Enter height and base"); /*prints Enter the value of x and y in new line*/
scanf("%d%d",&height,&base); /*It takes input from user and addresses corresponding to x & y*/
ans = (1/2)*height*base; /*mathematical formula*/
printf("Area of traingle is %f",ans); /*It prints the value after calculation*/
getch(); /* return the value zero to OS*/
}
The Final Output is:
Post a Comment