How to print all odd numbers using c programming

Print all odd number using c programming

Odd and Even number in c
Before doing the code to find all odd numbers using c programming, we have to know the logic behind the code. We have discussed the logical part in this post. Now it's time to write some code. But I suggest, please go back to the logical part of the code first. The logical thinking to find odd and even number is the same.

Code to print all odd number using c programming

int i, n, m;
First, define three integer variables. Then scan two integer values from user using scan function.
printf("Minimum range: \n");
printf("Maximum range: \n");
 Then run a for loop to travel in between the minimum and maximum range user has given. And in the loop section, if the statement will be used to determine whether the number is odd or even.

for(i=m; i<=n; i++){
The complete code for printing all add number in between given range is bellow: 

Programming is all about practice. So keep practicing and learn to program. I think now you know How to print all odd numbers using c programming in between a range given by the user. 

--------------------- Happy Coding ------------------------

Now time to practice the following:

Star printing pattern in c/java                            Calculate mod in c programming           

0/Post a Comment/Comments