Sunday, October 23, 2011

Odd Number Series

#include< stdio.h>
#include< conio.h>
void main( )
{
    int i,n;
    clrscr( );
    printf("Enter the range:");
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    {
        if(i%2!=0)
        printf("%d ",i);
    }
    getch( );
}

Output:-
Enter the range:11
1 3 5 7 9 11

No comments:

Post a Comment