C program for hypotenuse side of right angled triangle
Answers
Answered by
10
main()
{
float p,b,h;
printf("enter the peroendicular and bsae : ");
scanf("%f %f",&p,&b);
h=sqrt{(p*p)+(b*b)};
printf("The hypotenuse is: %f",h);
}
Answered by
8
#include<stdio.h>/*this header file allows us to use the printf and scanf functions*/
#include<math.h> /*this header file helps us to use the power nad the square root function*/
int main()
{
float p,b,h;
printf("Enter the length of the perpendicular");
scanf("%f\n",&p);
printf("Enter the length of the base");
scanf("%f\n",&b);
h=squrt(pow(p,2)+pow(b,2));/*this is the logic for calculating hypotenuse*/
printf("The length of the hypotenuse of the right angled triangle is %f\n", h);
return 0;
}
Similar questions
Physics,
7 months ago
Math,
7 months ago
Biology,
7 months ago
Computer Science,
1 year ago
World Languages,
1 year ago