+ 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); } } } }
6 Respostas
+ 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);
}
}
}
}
+ 4
Thanks
+ 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.
+ 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".