Solved

Assuming That a User Enters 25 as the Value for X

Question 15

Multiple Choice

Assuming that a user enters 25 as the value for x, what is the output of the following code snippet?
Int x = 0;
Scanner in = new Scanner(System.in) ;
System.out.print("Enter a number: ") ;
X = in.nextInt() ;
If (x < 100)
{
X = x + 5;
}
If (x < 500)
{
X = x - 2;
}
If (x > 10)
{
X++;
}
Else
{
X--;
}
System.out.println(x) ;


A) 27
B) 28
C) 29
D) 30

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents