CS50 valid triangle — incorrect code output

The code below compiles, runs, and takes input, but it does not output true or false as intended. I'm not sure what I am doing wrong.

#include <stdio.h>
#include <cs50.h>

//int add_two_ints(int a, int b);
bool valid_triangle (float a, float b, float c);
int main (void)
{

        float a = get_float("Enter Side 1:");
        float b = get_float("Enter Side 2:");
        float c = get_float("Enter Side 3:");
}

bool valid_triangle (float a, float b, float c)
{   //checks if two sides are greater than one
    if ((a + b <= c) || (a + c <= b) || (b + c <= a))
    {
        return false;
    }

    //checks for positive sides
    if (a <= 0 || b <= 0 || c <= 0 )
    {
        return false;
    }
     //if conditions are met print true
    else
        return true;
}


Read more here: https://stackoverflow.com/questions/68462487/cs50-valid-triangle-incorrect-code-output

Content Attribution

This content was originally published by Charlesu49 at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: