Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Test {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String input = scanner.nextLine();
- int sum = 0;
- for (int i = 0; i < input.length() ; i++) {
- int n = Integer.parseInt("" + input.charAt(i));
- int factoSum = 1;
- for (int j = n; j >= 1; j--) {
- factoSum *=j;
- }
- sum+= factoSum;
- }
- int number= Integer.parseInt(input);
- if (sum == number){
- System.out.println("yes");
- }else{
- System.out.println("no");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement