+ 8

pls what my error

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

27th Dec 2020, 1:49 PM
VṢtēphen
VṢtēphen - avatar
6 odpowiedzi
+ 4
using System; using System.Collections.Generic; namespace SoloLearn { class Program { static void Main(string[] args) { int x = Convert.ToInt32(Console.ReadLine()); //your code goes here for (int y = 1; y <= x; y++) if (y%3 == 0){ Console.WriteLine("*");} else {Console.WriteLine(y); } } } }
27th Dec 2020, 2:47 PM
JaScript
JaScript - avatar
+ 4
Thanks
27th Dec 2020, 2:48 PM
VṢtēphen
VṢtēphen - avatar
+ 2
.Osama Deep. I just tried that line and it seems perfectly fine. Console.ReadLine() returns a string that needs to be converted to int.
27th Dec 2020, 2:20 PM
Apollo-Roboto
Apollo-Roboto - avatar
+ 1
When asking a question, you should give as much information as you can, it would be nice to know what is the result you are trying to get. So keep that in mind for next time. I can't be sure if that is what you need but I will try to help. x <= x seems very wrong to me, i would suggest replacing this second x with a different variable that could be named "input".
27th Dec 2020, 2:08 PM
Apollo-Roboto
Apollo-Roboto - avatar