Print Odd numbers between an interval
C program to print ODD numbers between an interval
Program
#include<stdio.h>
#include<conio.h>
void main()
{
int low, high, i;
printf("Enter two numbers (interval)\t:");
scanf("%d%d",&low,&high);
printf("Odd number from %d to %d are\n",low,high);
for(i=low;i<=high;i++)
{
if(i % 2 != 0)
{
printf("%d ",i);
}
}
getch();
}
Output
Enter two numbers (interval) :5
50
Odd number from 5 to 50 are
5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49