write an pseudocode to display all even numbers between 1 to 100.
Answers
Answered by
5
Answer:
Explanation:
/*
Even no. between 1 to 100 starts from 2 and goes up to 100.
So we’ll use a for loop,
start it from 2 and increment i by 2 till we reach 100
*/
PrintEven()
Begin
for i = 2 to 100 by 2 do
Print: i and go to new line;
endfor
End
Answered by
0
for i in range(1,101):
if i % 2 == 0:
print(i)
- This pseudocode uses a for loop to iterate over the range from 1 to 100. For each number, it checks if the number is even by checking if the remainder when dividing by 2 is equal to 0 (i % 2 == 0).
- If the number is even, it is printed. The loop will repeat this process 100 times, printing all even numbers between 1 and 100.
#SPJ3
Similar questions
Accountancy,
6 months ago
Science,
6 months ago
Social Sciences,
6 months ago
Math,
1 year ago
History,
1 year ago