0% found this document useful (0 votes)
28 views1 page

Numerical Sample

The document presents a Java code snippet that asks a math question involving the order of operations. It checks the user's answer to the question 'What is the result of 2 + 3 * 5?' and provides feedback on whether the answer is correct or incorrect. If the answer is correct, the score is incremented by one.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views1 page

Numerical Sample

The document presents a Java code snippet that asks a math question involving the order of operations. It checks the user's answer to the question 'What is the result of 2 + 3 * 5?' and provides feedback on whether the answer is correct or incorrect. If the answer is correct, the score is incremented by one.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

System.out.println("Question 4: What is the result of 2 + 3 * 5?

");
System.out.print("Answer: ");
int answer4 = scanner.nextInt();
if(answer4 == 17) {
System.out.println("Correct");
score++;
} else {
System.out.println("Incorrect");
}

You might also like