this does not fully work. It is not suppose to. It is to only help give another point of view on some logic that might help to figure this out. So do not completely rely on this code because I took some out, so just apply the Proper logic instead using process of elimination. Where ? is the var holding the max value if true.
Code:
#include <stdio.h>
int main (void)
{
int a = 0, b = 0, c = 0, max = 0;
printf("enter three whole numbers\n");
scanf(" %d%d%d", &a,&b,&c);
if ( /* some value checks go here */ )
max = ?;
else if ( /* some value checks go here */ )
max = ?;
else if ( /* some value checks go here */ )
max = ?;
printf("max number is %d\n"
"out of these three\n"
"a %d, b %d c %d\n", max, a,b,c);
return 0;
}
if one is bigger then the other two then that is the largest number, so how would you check one unknown number against two other unknown numbers to find the largest number?
This code is in lue of using an array and a loop to do it. As it looks like that is what your are working on. Not using an array and loop to find largest number.
( it is not that much to type, so why copy paste? but yeah you got a watch out for that copy paste and getting hidden formatting codes in text when you do that).