Thursday, 12 December 2019

write a java program to check the given number is palindrome or not.

Program :


class Palindrome
{
public static void main(String[] args) {
int n = 123 ;

int p = n , s = 0 ;
while(n>0)
{
int z  = n%10 ;

s = (s*10) + z ;

n = n/10 ;
}

if (s == p)

System.out.println("It is a Palindrome " +s);

System.out.println("It is not a Palindrome " +s);
}

}

Output :


No comments:

Post a Comment

Write a java program to input marks of 5 student if 5 subject out of 100 marks each , output sum and percentage of marks and appropriate division i.e distigusion first class upto fail

Programe : import java.util.*; class Student { public static void main(String args[])     {     Scanner s = ...