import java.util.*;
class Assignment_11
{
public static void main()
{
Scanner sc=new Scanner(System.in);
System.out.println ("1.Checks value for palindrome");
System.out.println ("2.Checks value for perfect number");
System.out.println ("Enter your choice");
int ch=sc.nextInt();
System.out.println("Enter number");
int n=sc.nextInt();
switch(ch)
{
case 1:
int r=0,d,bk=n;
while(bk!=0)
{
d=bk%10;
r=r*10+d;
bk=bk/10;
}
if(r==n)
System.out.println("Value is a palindrome number");
else
System.out.println("Value is not a palindrome number");
break;
case 2:
int i,s=0;
for (i=0;i
{
if(n%i==0)
s=s+i;
}
if(s==n)
System.out.println("number is perfect");
else
System.out.println("number is not perfect");
break;
default:
System.out.println("invalid choice");
}
}
}
Answers
Answered by
0
Answer:
Aur thoda bada question puch lo
Similar questions
Math,
1 month ago
Math,
1 month ago
India Languages,
3 months ago
Math,
3 months ago
India Languages,
9 months ago
English,
9 months ago