Hello again!
I am having some trouble on this right triangle program I have to write for class. I have it written out, and it compiled/runs just fine. The problem is that it says everything is a right triangle! lol. Not completely sure why, but I know not everything I type in there could possibly be a right triangle. I was wondering if somebody might take a look at what I've got for me to try and figure out what's wrong?
Code:
# include <stdio.h>
# include <math.h>
int main()
{
double a;
double b;
double c;
double hypotenuse;
/*get lengths from user*/
printf("Insert the length of the hypotenuse, followed by the two\n");
printf("other sides of the triangle.\n");
scanf("%lf%lf%lf", &c, &a, &b);
c = sqrt((a * a)+(b * b));
if ((c = sqrt((a * a)+(b * b))))
{
printf("This is a right triangle");
}
else
{
printf("This is not a right triangle");
}
return 0;
}
Sorry in advance if I did something stupid. I'm still really new to this! Thank you for any help!