this is my answer to my question that i wrote yesterday...
#include %26lt;stdio.h%26gt;
#include%26lt;conio.h%26gt;
double hypotenuse(double,double);
double hypotenuse(double a,double b)
{
return sqrt((a*a)+(b*b));
}
void main()
{
double side1,side2;
int i;
for(i=0;i%26lt;=3;i++)
{
printf("Enter side 1 and side 2 for triangle %d :",i+1);
scanf("%f%f",%26amp;side1,%26amp;side2);
printf("Hypotenuse for triangle %d is %f",i+1,hypotenuse(double,double));
}
return 0;
}
My answer to my c language question,pls check it for me..?
I personally would ask for the 2 sides separately. The scanf seems to be the only possible issue. I don't know how it separates the 2 floating point numbers.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment