I simply want to test if the 121 number is a palindrome or not. This should write to console “p”.
class Program
{
static void Main(string[] args)
{
int n, new = 0, mem;
n = 121;
mem = n;
while(n)
{
new = new*10 + n%10;
n=n/10;
}
if (new == mem)
Console.WriteLine("p");
}
}
I tried the code above and didn’t work. I get 17 errors.
One of the errors: Identifier expected at line 5.
4