Sunday, August 2, 2009

How do you compare 3 numbers in turbo C using the if statement?

something like this:


if (a%26gt;b)


{ if (a%26gt;c) max=a;


else max=c;}


else


{if (b%26gt;c) max=b;


else max=c;}

How do you compare 3 numbers in turbo C using the if statement?
if(a%26gt;b )


{


if(b%26gt;c)


printf(" a is max number")


else


{


if(c%26gt;a)


printf("c is max number")


}


}


else


{


if(b%26gt;c)


printf("b is max number")


else


printf("c is max number")


}
Reply:if(a%26gt;b%26amp;%26amp;a%26gt;c)


{


printf("a is biggest");


}


else if(b%26gt;a%26amp;%26amp;b%26gt;c)


{


printf(" b is biggest");


}


else if(c%26gt;a%26amp;%26amp;c%26gt;b)


{


printf("c is biggest");


}


that's all over........
Reply:Compare them for what?


No comments:

Post a Comment