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.
An easier method, with a switch statement, almost all can understand.
(NOTE, THIS IS NOT THE FULL CODE, JUST THE IF STATEMENT WHERE YOU HAVE TO PUT AFTER THE // Write your code here COMMENT)
if(n<=9){switch(n){case1:cout<<"one";break;case2:cout<<"two";break;case3:cout<<"three";break;case4:cout<<"four";break;case5:cout<<"five";break;case6:cout<<"six";break;case7:cout<<"seven";break;case8:cout<<"eight";break;case9:cout<<"nine";break;}}else{cout<<"Greater than 9";}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
An unexpected error occurred. Please try reloading the page. If problem persists, please contact support@hackerrank.com
Conditional Statements
You are viewing a single comment's thread. Return to all comments →
An easier method, with a switch statement, almost all can understand.
(NOTE, THIS IS NOT THE FULL CODE, JUST THE IF STATEMENT WHERE YOU HAVE TO PUT AFTER THE
// Write your code here
COMMENT)