Computer Science, asked by rohannthor, 5 months ago

II. Write the output of the given program codes:-
1. int a=50, b=60, c=70;
c+=(a>0 && a<50)?++a: a/b;
System.out.println(c);​

Answers

Answered by Tanushree1200
7

Answer:

c = (a>0 && a<50)? ++a : a/b

= ( 50>0 && a<50)? ++ a :a/b

&& - this symbol is logical and so if both statements are right then only it will be true. so both are not true so the answer will be false and output will come as a/b

= 50/60

double c = 0.83

hope it helps

MARK It As Brainliest Answer

don't forget to follow me

Answered by devanshd0007
5

Answer:

Order of Execution of print function is not from left to right , as often misunderstood. It depends upon the arguments , sub-expression and the compiler.

In this particular case , there are two logical operators in the argument of the print function. These are “AND” & “OR”. “AND” operation has higher precedence than “OR” operation, so it is evaluated first.

Hence, print function is evaluated in the following order:

1)print (a>45 or b>50 and c>10) #and operation is executed first.

2)print (a>45 or (0)) #Since b is not greater than 50 and c is not greater than 0.

3)print(1 or 0) # Since a is 50 and is greater than 45.

4)print(1)

Explanation:

mark as brainliest and thank i will follow u + thank ur 10 answers

Similar questions