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.
usingnamespacestd;intmain(){inta,b;cout<<"Enter the range of numbers: "<<endl;cin>>a>>b;for(inti=a;i<=b;i++){if(i<=9){switch(i){case1:cout<<"one"<<endl;case2:cout<<"two"<<endl;case3:cout<<"three"<<endl;case4:cout<<"four"<<endl;case5:cout<<"five"<<endl;case6:cout<<"six"<<endl;case7:cout<<"seven"<<endl;case8:cout<<"eight"<<endl;case9:cout<<"nine"<<endl;break;}}elseif(i%2==0){cout<<"even"<<endl;}elseif(i%2!=0){cout<<"odd"<<endl;}else{cout<<"Error in entry!!"<<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 →