Generate the series of odd and even numbers using while loop.
anyone tell me short way.
Answers
Answered by
0
Answer:
yup good morning beautiful hope your question yes you do you
Answered by
1
Explanation:
Odd Number, 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.
Even Number, Run a loop from 1 , that runs till N , increment the loop counter by 1 in each iteration. The loop structure should look like for(i=1; i<=N; i++) . Inside the loop body check even/odd condition. If the current number i is divisible by 2 then i is even.
Similar questions