III. Write output for the following
1. int x=50, y=10;
if(x>10 && x<=60)
cout<<x+y:
else
Answers
Answered by
0
Output:
Error (because of the colon instead of semicolon after x+y.
PS your else condition is incomplete too.
Correction:
int x=50, y=10;
if(x>10 && x<=60)
cout<<x+y;
Output:
60
Explanation:
If statement check the condition weather x is greater than and also weather it is smaller or equal to 60 or not, only when these both conditions are are stratified which is what happened here the next statement is run.
&& is acting like the AND gate here.
Additional:
II does the job of OR gate i.e only one of the conditions are needed to be satisfied in order for next statement to run.
Similar questions