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.
//Compares the values of a, b with 9 and if values <= 9 then//Prints all values from 'a' uptill 'b' in string formatif((a<=9)&&(b<=9)){for(n=a;n<=b;n++){cout<<intMap[n-1]<<endl;}}//Compares the values of a, b with 9//And if the value of a <= 9 and value of b > 9 then....elseif((a<=9)&&(b>9)){//Prints all the values starting from 'a' uptill 9//in string format and then....for(n=a;n<=9;n++){cout<<intMap[n-1]<<endl;}//For values which are greater than 9 and <= to 'b'//Prints 'even' or 'odd' for themfor(n=10;n<=b;n++){if(n%2==0){cout<<"even"<<endl;}else{cout<<"odd"<<endl;}}}Hopethathelps.
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 →