Program for Checking a Number is Palindrome or Not :-
System.out.println("Number is Palindrome");
else
System.out.println("Number is not Palindrome");
}
}
Console.WriteLine("Number is Palindrome");
else
Console.WriteLine("Number is not Palindrome");
}
}
Program in C :-
#include<stdio.h>
#include<conio.h>
void main()
{
int num,a,num2=0,num3;
#include<conio.h>
void main()
{
int num,a,num2=0,num3;
printf("Enter a Number \n");
scanf("%d",&num);
scanf("%d",&num);
num3=num;
while(num>0)
{
a=num%10;
num2=num2*10+a;
num=num/10;
}
}
if(num2==num3)
printf("Number is Palindrome");
else
printf("Number is not Palindrome");
getch();
}
getch();
}
Program in Java :-
public class TestNumber
{
public sttaic void main(String args[])
{
int num,a,num2=0,nu3;
System.out.println("Enter a Number");
Console con=System.console(System.in);
num=Integer.parseInt(con.readLine());
{
public sttaic void main(String args[])
{
int num,a,num2=0,nu3;
System.out.println("Enter a Number");
Console con=System.console(System.in);
num=Integer.parseInt(con.readLine());
num3=num;
while(num>0)
{
a=num%10;
num2=num2*10+a;
num=num/10;
}
if(nun2==num3)}
System.out.println("Number is Palindrome");
else
System.out.println("Number is not Palindrome");
}
}
Program in C# :-
public class Test
{
public static void Main()
{
int num,a,num2=0,num3;
Console.WriteLine("Enter a Number");
num=Integer.Parse(Console.ReadLine());
{
public static void Main()
{
int num,a,num2=0,num3;
Console.WriteLine("Enter a Number");
num=Integer.Parse(Console.ReadLine());
num3=num;
while(num>0)
{
a=num%10;
num2=num2*10+a;
num=num/10;
}
if(num2==num3)}
Console.WriteLine("Number is Palindrome");
else
Console.WriteLine("Number is not Palindrome");
}
}
{ 0 comments... read them below or add one }
Post a Comment