Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class game {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- int result = 0;
- int N = Integer.parseInt(sc.nextLine());
- int f=N/100;
- int s=(N/10)%10;
- int t=(N%10);
- if(s==1||s==0){ result=f+s+t;} //second = 1 or 0
- else if (t==0&&f==1){result=f+s+t;} //third = 0 first =1
- else if (t==0&&f!=1){result=f*s+t;} //third = 0
- else if (t==1&&f==1){result=f+s+t;} //third = 1 first =1
- else if (t==1&&f!=1){result=f*s+t;} //third = 1
- else if (f==1||f==0){result=f+s*t;}
- else{result=f*s*t;}
- System.out.println(result);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement