this program will count hypotenuse of triangle if other two sides are entered.the formula to find hypotenouse is goiven by:
hypo=(x*x)+(y*y)
Program:
#include<stdio.h>
#include<conio.h>
#include<math.h>
int hyp(int,int);
main()
{
int a,b;
clrscr();
printf("Enter side 1: ");
scanf("%d",&a);
printf("\nEnter side 2: ");
scanf("%d",&b);
printf("\nHypotenous is %d",hyp(a,b));
getch();
}
int hyp(x,y)
{
int hypo;
hypo=sqrt((x*x)+(y*y));
return hypo;
}
hypo=(x*x)+(y*y)
Program:
#include<stdio.h>
#include<conio.h>
#include<math.h>
int hyp(int,int);
main()
{
int a,b;
clrscr();
printf("Enter side 1: ");
scanf("%d",&a);
printf("\nEnter side 2: ");
scanf("%d",&b);
printf("\nHypotenous is %d",hyp(a,b));
getch();
}
int hyp(x,y)
{
int hypo;
hypo=sqrt((x*x)+(y*y));
return hypo;
}