例如:輸入123,輸出1 x 2 x 3 = 6。
- import java.util.Scanner;
- public class C1
- {
- public static void main(String[] args)
- {
- Scanner input = new Scanner(System.in);
- System.out.println("請輸日一個三位整數");
- int a = input.nextInt();
- int b = a / 100;
- int c = ( a - b * 100 ) / 10;
- int d = a - 100 * b - 10 * c;
- int e = b * c * d;
- System.out.println("該數值每個位數所相乘後的質:" + e);
- }
- }
沒有留言:
張貼留言