I am making a program that computes for the hypotenuse of a right triangle using the pythagorian theorem.
THis is the code i made:
The code is incomplete, because i don't know how to make it solve for the square root of a number. Also, i don't really get how to use functions. Can someone please explain the return thing at the end of the function.
Thanks in Advance
THis is the code i made:
Code:
#include <stdio.h>
float Hypotenuse(float side1, float side2);
int main()
{
float side1;
float side2;
printf("Enter the first side:");
scanf("%f", side1);
printf("Enter the second side:");
scanf("%f", side2);
float Hypotenuse(float side1, float side2);
printf("The hypotenuse is %f", Hypotenuse);
}
float Hypotenuse(float side1, float side2)
{
float Hypotenuse;
square_of_side_1 = side1 * side1
square_of_side_2 = side2 * side2
sum_of_the_square_of_both_sides = square_of_side_1 + square_of_side_2
Hypotenuse =
return;
}
Thanks in Advance
Last edited by a moderator: