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