I have modified the code to this and I think it is giving correct answers.
#include <stdio.h>
#include <math.h>
int main(void)
{
double lega;
double legb;
double hypotenuse;
printf("Enter lega: ");
scanf("%lf", &lega);
printf("Enter legb: ");
scanf("%lf", &legb);
hypotenuse = sqrt(lega*lega + legb*legb);
printf("The hypotenuse of a right triangle with lega of %f and legb of %f is %f.\n", lega, legb, hypotenuse);
return(0);
}
Note: Please be sure that the contents of printf are in one line. A lot of error pops up just for breaking the printf contents in 2 lines. Don't know why .
Also note that there is no variable as a or b, the variables are lega and legb.