To print all even numbers from 2 to 50 using while loop
Answers
Answered by
0
Answer:
There are two variables declared in the program 1) number as a loop counter and 2) n to store the limit.
Reading value of n by the user.
Initialising loop counter (number) by 1 as initial value number =1
Using while loop by checking the condition number<=n (value of number is less than or equal to n) - this will execute the loop until the value of number is less than or equal to n.
Then, within the loop, we are checking the condition to check whether number is EVEN or not, the condition is (number%2==0) - it returns true if number is divisible by 2.
Answered by
0
Answer:
I hope this will help you output also attached
Explanation:
Mark me as Brain list answer
Attachments:
Similar questions