New course! Every coder should learn Generative AI!
Try a free lesson+ 1
@Savant
The Console.ReadLine(); method reads a string, but you declared a as an integer.
Instead of
int a;
Do
string a;
Similarly, because it is a string, you'll need to convert it to an integer now to do the calculation.
Instead of
int x = a;
Dp
int x = int.Parse(a);
You also forgot to put a semicolon by "Console.ReadLine()". It should be "Console.ReadLine();"
The code should be working fine now.
Full code:
https://code.sololearn.com/cwOqDLM08557/#cs