spy number

Posted on Nov. 16, 2022
badri
251

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 " ) ;

          }

     }

}




0 comments

Please log in to leave a comment.

Author
lawrence
lawrence

1 posts

Share this