display all the odd numbers between the range the user inputs
****************** Display all the odd numbers
between the range the user inputs ************
I need help putting this into c language^^^
I tried to write it out but I'm not sure how to convert it to C language...
get inputs from user with scanf
check if the minimum number is odd or even
if odd
print minimum number, then add 2, add 2, add 2... to n
if even
add 1, then add 2, add 2, add 2, add 2... to n
Re: display all the odd numbers between the range the user inputs
Try the following code :thumbup1:
Code:
#include <stdio.h>
main()
{
int i,num;
clrscr();
printf("\n Input the range upto which you want to print ");
scanf("%d",&num);
for(i=1;i<num;i=i+2)
{
printf("\n%d",i);
}
getch();
}