HW3.5

时间:2023-11-12 21:33:38

HW3.5

 import java.util.Scanner;

 public class Solution
 {
     public static void main(String[] args)
     {
         int n1 = (int)(Math.random() * 10);
         int n2 = (int)(Math.random() * 10);
         int n3 = (int)(Math.random() * 10);

         Scanner input = new Scanner(System.in);
         System.out.print(n1 + " + " + n2 + " + " + n3 + " = ? ");
         int sum = input.nextInt();

         input.close();

         if(sum == n1 + n2 + n3)
             System.out.println("True");
         else
             System.out.println("False");
     }
 }

相关文章