In this article I would like to share with you a simple program that will ask the user to give a word or a string and then our program will check if the given word or a string is a palindrome or not a palindrome. I am using C# as my programming language in this sample program. Thank you.
Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com.
My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.
My mobile number here in the Philippines is 09173084360.
Sample Program Output
Program Listing
using System;
namespace palindrome_checker
{
class palindrome_check
{
static void Main(string[] args)
{
string string_given, reverse_string = "";
string string_upper;
Console.Write("\n\n");
Console.Write("\t Palindrome Checker in C#");
Console.Write("\n\n\n");
Console.Write("\tGiven Any Word or String : ");
string_given = Console.ReadLine();
for (int a = string_given.Length - 1; a >= 0; a--)
{
reverse_string += string_given[a].ToString();
}
string_upper = reverse_string.ToUpper();
if (reverse_string == string_given)
{
Console.Write("\n\n");
Console.WriteLine("\tThe given word or a string {0} is a Palindrome.",string_upper);
}
else
{
Console.Write("\n\n");
Console.WriteLine("\tThe given word or a string {0} is Not a Palindrome.",string_upper);
}
Console.Write("\n\n");
Console.Write("\tThank You For Using This Software.");
Console.Write("\n\n");
Console.ReadKey();
}
}
}