conditional statement | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

conditional statement

give a positive integer n , do the following : if 1 =<n=<9 then print the lowercase English word corresponding to the number (e.g; one for 1 , two for 2, ets) if n>9 print greater than 9

13th Feb 2018, 8:08 PM
Asma' Hattab
Asma' Hattab - avatar
2 Answers
+ 3
I'd use this because it is simple to understand: switch (n) { case 1: cout << "one"; break; .... default: cout << "greater than 9"; break; } if (n==1) cout << "one"; else if (n==2) ... works too.
13th Feb 2018, 8:21 PM
John Wells
John Wells - avatar
0
switch (n) { case 1: cout << "one"; break; .... default: cout << "greater than 9"; break; } if (n==1) cout << "one"; else if (n==2) ... works too.
14th Feb 2018, 5:48 AM
MD. Ismail Hossain
MD. Ismail Hossain - avatar