+ 1

If I would like to make the output like this: 5 , 10 , 15 how can I coding for just 2 commas sign?

https://code.sololearn.com/chVT9HEmy1B8/?ref=app

16th Nov 2017, 3:58 PM
little rabbiz
little rabbiz - avatar
2 Réponses
+ 1
If I correctly understand your question, use: for(int y=5;y<=15;y+=5){ if(y!=5){ cout<< " , "; } cout<<y; } This way 15 could be changed to any number and you will get the right number of commas.
16th Nov 2017, 4:26 PM
John Wells
John Wells - avatar
0
Thank you very much for your kindness seggestion, it's very useful for me, now I can print out any number without a comma after last number already. https://code.sololearn.com/cFdcuyB198Kl/?ref=app
17th Nov 2017, 1:19 AM
little rabbiz
little rabbiz - avatar