Docsity

Problem Set 5 Solutions - Introduction-Computer Science | CS 110, Assignments of Computer Science

Partial preview of the text

Download Problem Set 5 Solutions - Introduction-Computer Science | CS 110 and more Assignments Computer Science in PDF only on Docsity!

CS110 Homework Set 5 Solution P303 #14, #16, #18, # 10 points total

#14 2 points Answer: 0 10 30 60

#16 3 points a. iii 26

b. iv. 5

c. i 0

#18 3 points

public class Assignment { public static void main (String[] args) { int num = 0; for (int i = 0; i< 100; i ++) { if (i%3 == 0) num += i; } System.out.println(num); } }

#20 2 points Answer: 11 19 30 49