Print 1st 10 multiples of 3 using while loopi=11while(i<11): print(3*i) i=i+1i=1while(i<11): print(3*i) i=i+1i=1while(i<10): print(3*i) i=i-1None of the above
Question
Print 1st 10 multiples of 3 using while loopi=11while(i<11): print(3i) i=i+1i=1while(i<11): print(3i) i=i+1i=1while(i<10): print(3*i) i=i-1None of the above
Solution
The correct answer is:
i=1
while(i<11):
print(3*i)
i=i+1
This Python code will print the first 10 multiples of 3. It starts with i=1 and for each iteration, it prints the product of 3 and i (which gives the multiples of 3), and then increments i by 1. The loop continues until i is less than 11, which means it will print the multiples of 3 from 1 to 10.
Similar Questions
What will be the output for the following code?i=0while(i<3): j=0 while(j<3): print(i,j,end=" ") j+=1 print()
Study the following program:i = 0while i < 3: print(i) i += 1 else: print(0) 0 10 1 20 1 2 00 1 2 3
What will be the output of the following Python code?i = 1while True: if i%3 == 0: continue print(i) i+ =11 21 2 3errorNone of the mentioned
What is the output produced when this code executes?i = 1while(i<=7):i *= 2print(i)816414
What will be the result?1. int i = 10;2. while(i++ <= 10){3. i++;4. }5. System.out.print(i);10111213
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.