/******************************************************/ /* Introduction to Programming */ /* By Dr. ANTF */ /* www.antf.net */ /* Copyright 2015 */ /* */ /* C# 316 - Problem 15: Palindrome */ /******************************************************/ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace DOS { class Program { static void Main(string[] args) { int n, rev; Console.Write("Please enter a number: "); n = int.Parse(Console.ReadLine()); Console.WriteLine("\n"); for (int i = 10; i < n; i++) { //find the reverse of i int temp = i; rev = 0; while(temp != 0) { rev = (rev * 10) + (temp % 10); temp /= 10; } //check for palindrome if (rev == i) Console.Write("{0}, ", i); } Console.ReadKey(); } } }