How we print a result in single line? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How we print a result in single line?

using System; using System.Collections.Generic; namespace SoloLearn { class Program { static void Main(string[] args) { int number = Convert.ToInt32(Console.ReadLine()); //your code goes here for(int i=1; i< number; i++) { if(i%3==0) { Console.WriteLine('*'); } else { Console.WriteLine(i); } } Console.WriteLine(number); } } } Help

19th Jun 2022, 11:55 AM
ABDUL ROUF rouf
ABDUL ROUF rouf - avatar
2 Answers
+ 2
Use only Console.Write() if you don't want a line break.
19th Jun 2022, 12:11 PM
Ani Jona 🕊
Ani Jona 🕊 - avatar
+ 3
Please make sure you're tagging the appropriate language.
19th Jun 2022, 12:23 PM
Justice
Justice - avatar