can anyone help me to fixed this code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

can anyone help me to fixed this code

int number = Convert.ToInt32(Console.ReadLine()); for (int i=1;i<=number;i++) { if (i%3==0) { i="*"; } Console.Write(i); }

30th May 2021, 7:46 AM
Manar Saleh
Manar Saleh - avatar
3 Answers
+ 7
//try this for (int i=1;i<=number;i++) { if (i%3==0) { Console.Write("*"); } else { Console.Write(i); } }
30th May 2021, 8:25 AM
Simba
Simba - avatar
+ 1
you didn't close the curly braces of your for loop ;P
30th May 2021, 7:48 AM
visph
visph - avatar
0
When the input =7 Output must = 12*45*7
30th May 2021, 8:15 AM
Manar Saleh
Manar Saleh - avatar