#include <stdio.h>
#include <math.h>
double hypotenuse(double side1, double side2);
int main(void)
{
double a, b;
printf("Enter the values of the two sides: ");
scanf("%f %f", &a, &b);
printf("\nThe length of hypotenuse is: %f", hypotenuse(a, b));
getchar();
getchar();
return 0;
}
double hypotenuse(double side1, double side2)
{
double c;
c = (side1 * side1) + (side2 * side2);
return sqrt(c);
}
Данная программа работает, когда я использую float a, b;
вместо double a,b;
. Зачем?Почему `sqrt()` печатает желаемый результат, когда я использую `float` вместо` double `?
Любые вопросы, остающиеся для этой записи? – chux