0

Can someone help me with this problem. I had just started to learn coding C#.

Multiple of 3 You are an elementary school teacher and explaining multiplication to students. You are going to use multiplication by 3 as your example. The program you are given takes N number as input. Write a program to output all numbers from 1 to N, replacing all numbers that are multiples of 3 by "*".

30th Oct 2022, 6:59 PM
Zoran Maric
4 Réponses
+ 2
int N = Convert.ToInt32(Console.ReadLine()); for (int i=1; i<=N; i++) if (i%3==0) Console.Write("* "); else Console.Write(
quot;{i} "); https://www.sololearn.com/compiler-playground/cU2DClh2C7we
30th Oct 2022, 7:25 PM
SoloProg
SoloProg - avatar
+ 1
Error Your output 1 2 * 4 5 * 7 Expected output 12*45*7
31st Oct 2022, 10:07 AM
Zoran Maric
+ 1
// Zoran Maric , chk again int N = Convert.ToInt32(Console.ReadLine()); for (int i=1; i<=N; i++) Console.Write(i%3==0?"*":
quot;{i}");
31st Oct 2022, 10:25 AM
SoloProg
SoloProg - avatar
+ 1
This one works. Thank you bro. Now it will take some time to understand it :)
31st Oct 2022, 4:26 PM
Zoran Maric