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.
#include<iostream>#include<cstdio>usingnamespacestd;intmain(){// Complete the code.inta,b;intn=0;stringintMap[9]={"one","two","three","four","five","six","seven","eight","nine"};cin>>a>>b;if((a<=9)&&(b<=9)){for(n=a;n<=b;n++){cout<<intMap[n-1]<<endl;}}elseif((a<=9)&&(b>9)){for(n=a;n<=9;n++){cout<<intMap[n-1]<<endl;}for(n=10;n<=b;n++){if(n%2==0){cout<<"even"<<endl;}else{cout<<"odd"<<endl;}}}else{for(n=a;n<=b;n++){if(n%2==0){cout<<"even"<<endl;}else{cout<<"odd"<<endl;}}}return0;}
For Loop
You are viewing a single comment's thread. Return to all comments →
Great code, I like it.
Here is mine: