Top Posters
Since Sunday
a
5
k
5
c
5
B
5
l
5
C
4
s
4
a
4
t
4
i
4
r
4
r
4
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 158 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
  1318 People Browsing
 112 Signed Up Today
Related Images
  
 289
  
 332
  
 34
Your Opinion
What's your favorite math subject?
Votes: 293