I am trying to create a function by which I can check if the data entered match a triangle or not. I managed to do the function, but I am having a trouble in calling it in main. I want the output to be either true or false. Thanks.
#include <cs50.h>
#include <stdio.h>
bool triangle(float a, float b, float c);
int main(void)
{
// This is where I miss the point and need help with. A little explanation would be great. Thanks.
printf("%d", triangle(3, -7, 8));
}
bool triangle(float a, float b, float c)
{
if (a <= 0 || b <= 0 || c <= 0)
{
return false;
}
if ((a + b <= c) || (a + c <= b) || (c + b <= a))
{
return false;
}
return true;
}