Math, asked by Meghana9589, 1 year ago

C program for hypotenuse side of right angled triangle

Answers

Answered by imhkp4u
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 HrishikeshSangha
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