import java.util.Random; import java.util.Scanner; public class AdditionQuiz { public static void main(String args[]) { Random random = new Random(); int n1 = random.nextInt(10); int n2 = random.nextInt(10); Scanner in = new Scanner(System.in); System.out.print(n1 + " + " + n2 + " = "); int sum = in.nextInt(); boolean correct = (n1 + n2 == sum); System.out.println(n1 + " + " + n2 + " = " + sum + " is " + correct); in.close(); } }