Skip to content

Instantly share code, notes, and snippets.

@LokeshKumarES
Last active July 8, 2022 11:26
Show Gist options
  • Save LokeshKumarES/bceccecec0ba1d609af3fb77511a18f3 to your computer and use it in GitHub Desktop.
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.
#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;
}
@SriyanshKumar
Copy link

cant we use pow() ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment