Monday 21 May 2012

PROGRAM TO GENARATE ODD NUMBERS BETWEEN TWO GIVEN NUMBERS


#include<stdio.h>
#include<conio.h>
void main(){
int x,y,i;
clrscr();
printf("enter the lower limit");
scanf("%d%",&x);
printf("enter the upper limit");
scanf("%d",&y);
i=x;
while(i<=y)
{
if(i%2!=0)
printf(" %d",i);
i++;
}
}
Output:-
enter the lower limit1
enter the upper limit10
1 3 5 7 9

No comments:

Post a Comment