write the output for the following code statemant
a. a=100
b=20
s=0
while a>=b:
if a%5==0
s+=a
a=1
print (s)
option are
(i)1020
(ii) 997
(iii) 1222
(iv) 1120
please tell me fast
Answers
Answered by
1
Answer:
C IS THE CORRECT ANSWER......
Explanation:
I
Answered by
0
The provided code sample contains an indentation mistake. The result, assuming proper indentation, would be:
(ii) 997
- Detailed explanation: Variables a, b, and s are all initialised to 100, 20, and 0 respectively, in the code. Then it enters a while loop, which keeps running as long as an is larger than or equal to b. The code determines if the value of an is divisible by 5 within the while loop. If so, the variable s is increased by the value of a.
- The value of an is then changed to 1. (which is an error in the code). As 1 is less than 20, the while loop will keep running. The while loop will then end, and the value of variable s, which would be 997 because the loop added the values of 100 and 995 to s, would be printed.
For more questions on Computer Science
https://brainly.in/question/22731028
#SPJ3
Similar questions