Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 3

import java.util.

*;
class Revnum
{
int Palin()
{
Scanner sc = new Scanner(System.in);
int n,r,sum=0,t,e;
System.out.println("Enter any number to check Palindrome");
n = sc.nextInt();
t=n;
while(n>0)
{
r = n%10;
sum = sum*10+r;
n = n/10;
}
if(t==sum)
return 1;
else
return 0;
}
int Arm()
{
Scanner sc = new Scanner(System.in);
int n,r,sum=0,t,m;
System.out.println("Enter any number to check Armstrong");
n = sc.nextInt();
t=n;
while(n>0)
{
r = n%10;
sum = sum+(r*r*r);
n = n/10;
}
if(t==sum)
{
return 1;
}
else
{
return 0;
}
}
int Auto()
{
Scanner sc = new Scanner(System.in);
int n,p,k,c=1,d;
System.out.println("Enter any number to check Automorphic");
n = sc.nextInt();
p=n;
k=n;
while(p>10)
{
p=p/10;
c=c*10;
}
k=k*k;
if(k%c==n)
{
return 1;
}
else
{
return 0;
}
}
int HCF()
{
Scanner sc = new Scanner(System.in);
int a,b;
System.out.println("Enter the value for a and b to calculate HCF");
a = sc.nextInt();
b = sc.nextInt();
while(a!=b)
{
if(a>b)
a=a-b;

else
b=b-a;
}
return a;
}
public static void main(String args[])
{
Revnum obj = new Revnum();
int d = obj.Arm();
if(d==1)
{
System.out.println("Armstrong number");
}
else
{
System.out.println("Not Armstrong");
}

int e= obj.Palin();
if(e==1)
{
System.out.println("Palindrome number");
}
else
{
System.out.println("Not");
}
int m = obj.Auto();
if(m==1)
{
System.out.println("Automorphic number");
}
else
{
System.out.println("Not");
}
obj.
}
}

You might also like