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 "*".
4 ответов
+ 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
+ 1
Error
Your output 1 2 * 4 5 * 7
Expected output 12*45*7
+ 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}");
+ 1
This one works. Thank you bro. Now it will take some time to understand it :)