0

I have created this function in C in which I am checking the validity of the sides of the triangle;

How can I get its true/false output? (I have already tried by just calling it in main but it didn't work)

This is the function that I have created;

bool valid_triangle(float a, float b, float c)
{
    //Check if all sides are positive

    if (a <= 0 || b <=0 || c <= 0)
    {
        return false;
    }
    //Check if two sides are less than the third one
    if ((a + b <= c) || (b + c <= a) || (a + c <= b))
    {
        return false;
    }

    return true;
}

I want its bool type value as output in the terminal.

wohlstad
  • 12,661
  • 10
  • 26
  • 39
Hadi
  • 1

0 Answers0