Program to print first n odd and even numbers using DO...WHILE loop.
C programming language.
also visit my channel for more such videos
/ @ankitanant
#programming
#coding
#c_code
#c_tutorial
#c_program
#programming_language
Explanation:-
Two variables i and n are declared as integer type.
i is initialized to 1(i=1).
n (should not be 0) is used to take input from user.
In do...while loop condition is checked after first execution.
All the statements inside this loop will be executed first and after incrementation of i (i.e. i=i+1=1+1=2), the condition will be checked i.e. is 2 less than or equal to n or not and so on untill the condition is false.
If n = 1 then first condition ( i.e. is 2 less than or equal to 1) is false and program ends but statements inside loop is executed once.