Download presentation
Presentation is loading. Please wait.
Published byCharlotte Berry Modified over 9 years ago
2
int num = 22; if (num > 0) if (num % 5 == 0) System.out.println(num); else System.out.println(num + “ is negative”);
3
int num = 22;//Formatted to show computer processing if (num > 0)// True { if (num % 5 == 0)// False System.out.println(num); else // Default response System.out.println(num + “ is negative”); }
4
int num = 22;//How programmer intended formatting if (num > 0)// True { if (num % 5 == 0)// False System.out.println(num);}else System.out.println(num + “ is negative”);
5
int x = 30, y = 40; if (x >= 0) { if (x <= 100) { y = x * 3; if (y < 50) x /= 10; }else y = x * 2; }else y = -x;
6
int x = 30, y = 40; if (x >= 0)// True { if (x <= 100)// True { y = x * 3;// y = 90 if (y < 50)//False; x stays 30 x /= 10; }else y = x * 2; }else y = -x;
7
a. same b. abc c. ABC d. sameabc e. there is no output
8
a. same b. abc c. ABC d. sameabc e. there is no output
9
a. 14 b. 23 c. 34 d. 4 e. 12
10
a. 14 b. 23 c. 34 d. 4 e. 12
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.