0
Hi guys..! I want the output to be columns
I'm studying C#, and I've been solving a problem that only outputs odd numbers. But in your problem, you want the output to be horizontal. The code I've written now appears vertically. Can you tell me how to do it? Below is the code I wrote using System; public class sololearn { public static void Main(String[] args) { int num = Convert.ToInt32(Console.ReadLine()); // your code goes here for(int i=1; i<=num; i++) { if(i%2!=0) { Console.WriteLine(
quot;{i}"); } } } }3 odpowiedzi
+ 2
Just write this in if condition:
// Console.Write() instead of Console.WriteLine() because 'writline' prints the output in next line.
Console.Write(quot;{i} ");
+ 1
i appreciate your help so much
+ 1
김민섭 Your welcome.