Home / Expert Answers / Computer Science / 6-what-is-the-output-of-the-following-code-int-operatorname-num-1-25-operatorname-n-pa675

(Solved): \( 6 . \) What is the output of the following code? int \( \operatorname{Num} 1=25, \operatorname{N ...




\( 6 . \)
What is the output of the following code?
int \( \operatorname{Num} 1=25, \operatorname{Num} 2=35 \), Sum \( =10 \)
\( 6 . \) What is the output of the following code? int \( \operatorname{Num} 1=25, \operatorname{Num} 2=35 \), Sum \( =10 \); if \( (\operatorname{Num} 1<\operatorname{Num} 2) \) Sum \( = \) Sum \( + \) Num 1 else Sum \( = \) Sum \( + \) Num2; Num1 \( +=15 \); \( \operatorname{Num} 2+=5 ; \) if \( ( \) Num \( 1<\operatorname{Num} 2) \) Sum \( =\mathrm{Sum}+ \) Num1; else \( \mathrm{Sum}=\mathrm{Sum}+\mathrm{Num} 2 \) System. Out.println (Sum);


We have an Answer from Expert

View Expert Answer

Expert Answer


Answer: The following piece of code will be executed as follows: There are three variables are initialised of type int such that, Num1 = 25, Num2 = 35, Sum = 10 Now the very first condition is if-else block. In if else block , when if condtion return
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe