+ 3
Help with cycle C#
I have code: int number = 11; for (int x = 1; number >= x; x++){ if (x % 5 != 0) Console.Write(x);} How change example 5, 10... to “-“? Result: 1234-6789-11
2 Antworten
+ 5
Just use "else" after "if" with Console.Write("-");
if(x%5 != 0)
Console.Write(x);
else
Console.Write("-");
+ 1
omg...
rly, thank you :)