1 posts
import java.util.Scanner;
class spy_number
{
public Static void main(String [ ] args)
{
Scanner scan=new Scanner(System.in);
System.out.println("enter the number ");
int num=scan.nextInt ();
int product=1;
int sum=0;
for (int b=num ; b!=0 ; b=b/10)
{
sum= sum+b%10;
product=product*b%10;
}
if (sum==product)
{
System.out.println( " it is spy number " ) ;
}
}
}
Please log in to leave a comment.