C++ program to print all odd numbers in given range

C++ program to print all odd numbers in given range


#include<iostream>

int main(){

    int number;
    int min,max;

    cout << "Enter the minimum range: ";
    cin >> min;

    cout << "Enter the maximum range: ";
    cin >> max;

    cout << "Odd numbers in given range are: ";
    for(number = min;number <= max; number++)

         if(number % 2 !=0)
             cout << number;

    return 0;

}

No comments:

Post a Comment