كود:
/*
Calculates the hypotenuse and area of a rectangular rectangle
*/
#include<stdio.h> /* printf, scanf definitions */
#include<math.h> /* sqrt, pow definitions */
double
hypotenuse(double a,double b)
{
return(sqrt(pow(a,2)+pow(b,2)));
}
double
area(double a,double b)
{
return((a+b)/2);
}
int
main(void)
{
double a; /* input - length */
double b; /* input - height */
/* 1&2. Get the height and length from the user. */
printf("Please Enter Rectangle Lenght: ");
scanf("%lf", &a);
printf("Please Enter Rectangle Height: ");
scanf("%lf", &b);
/* 3&4. Calculate the hypotenuse and area of the rectangle. */
hypotenuse(a,b);
area(a,b);
/* 5&6. Display the value of both. */
printf("H = %.2f\nA = %.2f\n", hypotenuse, area);
return(0);
}
ممكن أحد يعلمني فين الخطأ هنا؟ البرنامج اشتغل معاي تمام لكن كل ما ادخل ارقام يطلع لي أصفار، ما يحسبها صح.