Professional Documents
Culture Documents
Lab Manual Dot Net
Lab Manual Dot Net
V SEM - BCA
Paper: BCACsP5.4: Dot NET LAB PRACTICAL
LAB MANUAL
1. Write a Program in C# to Check whether a number is Palindrome or not.
using System;
public class palindrome
{
public static void Main(String[ ]args)
{
int n,r,sum=0,temp;
Console.WriteLine("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.WriteLine("Palindrome");
Console.ReadLine( );
}
else
{
Console.WriteLine(" Not Palindrome");
Console.ReadLine( );
}
}
}
}
}
}
}