We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
voidswitchFunction(intn){switch(n){case1:cout<<"one"<<endl;break;case2:cout<<"two"<<endl;break;case3:cout<<"three"<<endl;break;case4:cout<<"four"<<endl;break;case5:cout<<"five"<<endl;break;case6:cout<<"six"<<endl;break;case7:cout<<"seven"<<endl;break;case8:cout<<"eight"<<endl;break;case9:cout<<"nine"<<endl;break;default:cout<<"Greater than 9"<<endl;break;}}intmain(){// Complete the code.inta(0),b(0);cin>>a>>b;for(a;a<=b;a++){if(a>=1anda<=9){switchFunction(a);}else{if(a%2==0){cout<<"even"<<endl;}else{cout<<"odd"<<endl;}}}return0;}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
For Loop
You are viewing a single comment's thread. Return to all comments →
My C++ code 😎😁