Advertisement

07.12.2008 at 02:32PM PDT, ID: 23560055
[x]
Attachment Details

if else..

Asked by zizi21 in C Programming Language

hi,

i have like this:

if( value1 > value2)
maximum=value1;

else
maximum=value2;

there are many ways of doing this where way 1 is like above.

second way:
if( value1 > value2)
maximum=value1;

else if(value1 < value2)
maximum=value2;


in the first way, is my thinking right ? when i say : doesn't matter in the second else statement,
if value2==value1, because we have else statement, the maximum value gets assigned even if value2==value1 and not just value1 < value2

thanks.

Start Free Trial
[+][-]07.12.2008 at 02:37PM PDT, ID: 21990438

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: C Programming Language
Sign Up Now!
Solution Provided By: Infinity08
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628