Question 5.
Write a program to accept a number and check and display whether it is a spy number or not. (A number is spy if the sum of its digits equals the product of its digits.)
Answers
Answered by
6
- Explanation:
- import java.util.*;
- {
- public static void main (String args[ ])
- {
- int n,d1,de,ns,np,dtot;
- Scanner in=new Scanner(System.in);
- System.out.println("enter a no")
- d1=n/10;
- de=n%10;
- ns=d1+d2;
- dtot=ns+np
- if( dtot==n)
- System.out.println("special no");
- else
- System.out.println("not special no");
- }
- }
Similar questions