Top Posters
Since Sunday
L
3
d
3
y
3
a
3
n
3
d
3
e
3
d
3
c
3
p
3
M
3
a
3
New Topic  
Oughto Oughto
wrote...
Posts: 742
Rep: 1 0
7 years ago
What will be the values of ans, x, and y after the following statements are executed?

int ans = 35, x = 50, y =50;
if ( x >= y)
{
   ans = x + 10;
   x -=y;
}
else
{
   ans = y + 10;
   y += x;
}

A) ans = 60, x = 0, y = 50
B) ans = 45, x = 50, y = 0
C) ans = 60, x = 50, y =100
D) ans = 45, x = 50, y = 50
Textbook 
Starting Out with Java: Early Objects

Starting Out with Java: Early Objects


Edition: 4th
Author:
Read 168 times
3 Replies
Replies
Answer verified by a subject expert
ToothyToothy
wrote...
Top Poster
Posts: 744
Rep: 4 0
7 years ago
Sign in or Sign up in seconds to unlock everything for free
More solutions for this book are available here
1

Related Topics

Oughto Author
wrote...
7 years ago
I literally took this as a gen ed course, I was lost thought it would be easy

thx for making it easier on me
wrote...
7 years ago
Good luck tackling the rest
New Topic      
Explore
Post your homework questions and get free online help from our incredible volunteers
  1088 People Browsing
Related Images
  
 448
  
 795
  
 296
Your Opinion
Who will win the 2024 president election?
Votes: 19
Closes: November 4