Pages

100 Contemporary Living Room Designs

Wednesday, December 19, 2018

C++ PROGRAM TO DISPLAY ODD NUMBERS FROM 1 TO N

#include <iostream>

using namespace std;

int main()
{
    int n;
    cout<<"Enter the Limit\n";
    cin>>n;
    cout<<"Odd numbers between 1 and "<<n<<" are\n";
    for(int i=1;i<=n;i++)
    {
        if(i%2 != 0)
            cout<<i<<"\n";
    }
    return 0;
}

 

2 comments: