Even or Odd .of 50 number's

 

#include<iostream>

using namespace std;

int main(){

    char pen;

    cout<<"what do you want to find  [even/odd]"<<endl<<"for even press [E/e]"<<endl<<"for odd press [O/o]"<<endl;

    cin>>pen;

    if (pen == 'E' || pen == 'e'){

    for(int i = 1;i<50;++i){

        if(i%2==0){

            cout<<i<<"  ";

        }

    }

    }

    else {

        for(int i = 1;i<50;++i){

            if (i%2 != 0)

            cout<<i<<"  ";

        }

    }

    return 0;

}




Comments

Popular Posts