write the output.....
Attachments:
Answers
Answered by
1
Answer:
1,10,20,30,40,50
Explanation:
Answered by
2
Question:-
- Write the output of the given code.
Solution:-
Question 1:-
At first, S=0 and C=5
Now,
S=S+C
Or,
S=0+5=5.
Now,
C=C+3
Or,
C=8.
Now,
C<=10 is true since 8<=10
Now, we will go to line number 30.
So,
S=S+C
Or,
S=5+8=13
Now,
C=C+3
Or,
C=8+3=11
Now, C<=10 is false.
So,
If statement will not execute.
Now, the print statement gets executed.
So,
- Sum = 13.
Now, the program terminates.
Output:-
Sum=13.
Question 2:-
At first,
P=1
K=9
Now, K is printed.
9 is printed.
P=P*K=9
K=K-4=5
Now,
K>=3 is true.
So, we will shift to line 30.
Again, P=P*K
=9*5=45.
K=K-4=1.
Now, if part will not execute.
So, We will print P.
45 is printed.
Output:-
9
45
Similar questions