C# Palindrome program Tutorial with Examples

C# Palindrome program Tutorial with Examples

Today, We want to share with you .
In this post we will show you Palindrome program in C#, hear for palindrome program in c# without using string functions we will give you demo and example for implement.
In this post, we will learn about Program to Check Whether a String Palindrome is or not with an example.

Palindrome program in C#

In this post, we will learn about Palindrome program in C# with an example.

Now in this post, I will explain Palindrome program in C# with appropriate example. A palindrome number is a number that is same after reverse of it. For example 121, 38583, 303, 121, 48984, are the palindrome numbers.

READ :  Count total number of items in nested array in PHP

Palindrome number steps:

  • Get(Read) the number from user
  • Store the number in temporary variable
  • Reverse the number
  • Compare the temporary number with reversed number
  • If both the numbers are same, print the message palindrome number
  • Else print the message not palindrome number

Now create Console Application in Visual Studio and write below lines of code in it.

[php]
using System;

namespace InfinityKnow
{
class Program
{
static void Main(string[] args)
{
// Program to check whether the given number is paligdrom or not

int number, r, sum = 0, temp;
Console.Write(“Enter the Number to check Palindrome: “);
number = int.Parse(Console.ReadLine());
temp = number;
while (number > 0)
{
r = number % 10;
sum = (sum * 10) + r;
number = number / 10;
}
if (temp == sum)
Console.Write(“Number is Palindrome.”);
else
Console.Write(“Number is not Palindrome”);

READ :  Most Useful Tips and Tricks for Notepad++ Keyboard Shortcuts

Console.ReadKey(); // To hold the console screen.
}
}
}
[/php]

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about palindrome in c# using recursion.
I would like to have feedback on my Infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Leave a Comment