Opening Hours :7AM to 9PM
class SpyNumber { void spy(int n) { int sum = 0; int product = 1; while (n > 0) { int digit = n % 10; sum += digit; product *= digit; n /= 10; } System.out.println("Sum: " + sum); // prints "Sum: 8" System.out.println("Product: " + product); // prints "Product: 8" if(sum==product) { System.out.println("SpyNumber"); } else { System.out.println("Not aSpyNumber"); } } } public class Main { public static void main(String[] args) { SpyNumber s=new SpyNumber(); s.spy(1124); } }