+ 1
If I would like to make the output like this: 5 , 10 , 15 how can I coding for just 2 commas sign?
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.
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