Top Posters
Since Sunday
New Topic  
Eels Eels
wrote...
Posts: 716
Rep: 0 0
7 years ago
What will be the values of ans, x, and y after the following statements are executed?

int ans = 0, x = 15, y =25;
if ( x >= y)
{
   ans = x + 10;
   x -=y;
}
else
{
   ans = y + 10;
   y += x;
}

A) ans = 0, x = 15, y = 25
B) ans = 25, x = -10, y = 25
C) ans = 25, x = 15, y = 40
D) ans = 35, x = 15, y = 40
Textbook 
Starting Out with Java: Early Objects

Starting Out with Java: Early Objects


Edition: 4th
Author:
Read 86 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

Eels Author
wrote...
7 years ago
YOU'RE AWESOME
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
  1278 People Browsing
Related Images
  
 591
  
 302
  
 334
Your Opinion
Which of the following is the best resource to supplement your studies:
Votes: 292