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.
intmain(){stringn_temp;getline(cin,n_temp);intn=stoi(ltrim(rtrim(n_temp)));switch(n){case1:printf("one");break;case2:printf("two");break;case3:printf("three");break;case4:printf("four");break;case5:printf("five");break;case6:printf("six");break;case7:printf("seven");break;case8:printf("eight");break;case9:printf("nine");break;default:printf("Greater than 9");}return0;}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Conditional Statements
You are viewing a single comment's thread. Return to all comments →
Sol using switch: