Search This Blog

Thursday, October 13, 2011

Write a program to read two sides of a right triangle and find its hypotenuse.

   1:  #include<stdio.h>
   2:  #include<conio.h>
   3:  #include<math.h>
   4:  void main()
   5:  {
   6:  float a,b;
   7:  printf("Enter the two sides of right triangle:");
   8:  scanf("%f%f",&a,&b);
   9:  printf("\hypotenuse of right triangle is %f\n",hypot(a,b));
  10:  getch();
  11:  }

No comments:

Post a Comment