Palindrome program in C#
C# Programming Language Loop control in C# Language (Article) Loop control in C# Language (Program)
292Program:
using System; public class PalindromeExample { public static void Main(string[] args) { int n,r,sum=0,temp; Console.Write("Enter the Number: "); n = int.Parse(Console.ReadLine()); temp=n; while(n>0) { r=n%10; sum=(sum*10)+r; n=n/10; } if(temp==sum) Console.Write("Number is Palindrome."); else Console.Write("Number is not Palindrome"); } }
Output:
Output 1: Enter the Number=121 Number is Palindrome. Output 2: Enter the number=113 Number is not Palindrome.
Explanation:
None
This Particular section is dedicated to Programs only. If you want learn more about C# Programming Language. Then you can visit below links to get more depth on this subject.