Computer Science, asked by ppriyanshupandey350, 9 months ago

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 npalkrishna2001
6
  1. Explanation:
  2. import java.util.*;
  3. {
  4. public static void main (String args[ ])
  5. {
  6. int n,d1,de,ns,np,dtot;
  7. Scanner in=new Scanner(System.in);
  8. System.out.println("enter a no")
  9. d1=n/10;
  10. de=n%10;
  11. ns=d1+d2;
  12. dtot=ns+np
  13. if( dtot==n)
  14. System.out.println("special no");
  15. else
  16. System.out.println("not special no");
  17. }
  18. }
Similar questions