0

Multiples of 3 C#

I took on the challenge and came up with this: using System; using System.Collections.Generic; namespace SoloLearn { class Program { static void Main(string[] args) { int number = Convert.ToInt32(Console.ReadLine()); int value; //your code goes here while(value < number) { if(value % 3 == 0) { Console.Write("*"); value++; } else { Console.Write(value); value++; } } } } } yet it comes out with an error, can anyone help?

18th May 2021, 7:59 PM
Neurobean
Neurobean - avatar
6 Respostas
+ 2
variable value is not initialized int value = 0; would do
18th May 2021, 8:02 PM
minirkk
minirkk - avatar
+ 1
had to set it to 1
18th May 2021, 8:04 PM
Neurobean
Neurobean - avatar
+ 1
cos othwewise it would do *12*45*7
18th May 2021, 8:04 PM
Neurobean
Neurobean - avatar
0
what does that mean
18th May 2021, 8:02 PM
Neurobean
Neurobean - avatar
0
o u mean its not set
18th May 2021, 8:02 PM
Neurobean
Neurobean - avatar
0
ok
18th May 2021, 8:02 PM
Neurobean
Neurobean - avatar