what is nested if-else?
Answers
Answered by
2
The if-else statement allows a choice to be made between two possible alternatives. Sometimes a choice must be made between more than two possibilities. For example the sign function in mathematics returns -1 if the argument is less than zero, returns +1 if the argument is greater than zero and returns zero if the argument is zero. The following C++ statement implements this function:
if (x < 0)
sign = -1;
else
if (x == 0)
sign = 0;
else
sign = 1;
if (x < 0)
sign = -1;
else
if (x == 0)
sign = 0;
else
sign = 1;
stevechamlingrai:
this answer is too advanced for me. i can't able to understand i'm just in class 10
Similar questions