1 import java.util.Scanner; 2 3 public class Solution 4 { 5 public static void main(String[] args) 6 { 7 int n1 = (int)(Math.random() * 10); 8 int n2 = (int)(Math.random() * 10); 9 int n3 = (int)(Math.random() * 10); 10 11 Scanner input = new Scanner(System.in); 12 System.out.print(n1 + " + " + n2 + " + " + n3 + " = ? "); 13 int sum = input.nextInt(); 14 15 input.close(); 16 17 if(sum == n1 + n2 + n3) 18 System.out.println("True"); 19 else 20 System.out.println("False"); 21 } 22 }
时间: 2024-12-11 01:45:44