Last active
July 8, 2022 11:26
-
-
Save LokeshKumarES/bceccecec0ba1d609af3fb77511a18f3 to your computer and use it in GitHub Desktop.
If lengths of three sides of a triangle are input through the keyboard, write a program to find the area of the triangle.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
#include<conio.h> | |
#include<math.h> | |
int main() | |
{ | |
int a, b, c; //Triangle side's lengths | |
float s=0, area=0; | |
printf("Enter Length of AB: "); | |
scanf("%d", &a); | |
printf("Enter Length of BC: "); | |
scanf("%d", &b); | |
printf("Enter Length of CA: "); | |
scanf("%d", &c); | |
s = (a+b+c)/2; | |
area = sqrt(s*(s-a)*(s-b)*(s-c)); | |
printf("Area of Triangle is: %f", area); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
cant we use pow() ?