We are providing online training of realtime Live project on Asp.Net MVC with Angular and Web API. For more information click here. If you have any query then drop the messase in CONTACT FORM

Sunday, June 7, 2015


->Write a program a give the input and check the palindrome or not?

class Program

{ static void Main(string[] args)

{
int revers=0;

Console.WriteLine("Enter the number");

int n = Convert.ToInt32(Console.ReadLine());

int temp = n;

while (n > 0)

{
int reminder = n % 10;

revers = revers * 10 + reminder;

n = n / 10;

} 
Console.WriteLine(revers);

if(temp==revers)

{
Console.WriteLine("this is palindrome");

}
else

{
Console.WriteLine("this is not palindrome");

} Console.WriteLine();

Console.ReadLine();

}

}
 
 
 
 


OUTPUT:

Enter the number: 121
This is palindrome

Enter the number:121
This is not palindrome

No comments: