0
C# syntax
My (very basic) code is this: int number = Convert.ToInt32(Console.Readline()); if (number%3==0) Console.WriteLine(*); else Console.WriteLine(number++); The only error I get is: Invalid expression term ')' What am I missing? Thanks in advance!
4 Answers
+ 3
Kamil Hamid
No need of curly braces for single line statement.
Micah Whitcomb
Without double quotes a string will be considered as a variable but * cannot be use as a variable so there is invalid expression. So * should be inside double quotes.
+ 1
There are 2 mistakes
1st one ReadLine L should be capital.
2nd same like A͢J said.
0
int number = Convert.ToInt32(Console.ReadLine());
if (number%3==0)
Console.WriteLine("*");
else
Console.WriteLine(number++);
0
You forgot to put curly braces {} around the code of the if and else statements, and the asterisk should be in "" as a string. That should fix it