Computers and Technology

Consider the following two code segments. in both, assume that n is an integer variable that has been declared and initialized. segment 1 int prod = 1; int i; for (i = 2; i < = n; i++) { prod *= i; } system. out. println(prod); segment 2 int prod = 1; int i = 2; while (i < = n) { prod *= i; i++; } system. out. println(prod); for which integer values of n do these code segments print the same result?

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 11:10, lberman2005p77lfi
The total cost of textbooks for the term was collected from 36 students. create a histogram for this data. $140 $160 $160 $165 $180 $220 $235 $240 $250 $260 $280 $285 $285 $285 $290 $300 $300 $305 $310 $310 $315 $315 $320 $320 $330 $340 $345 $350 $355 $360 $360 $380 $395 $420 $460 $460
Answers: 2
image
Computers and Technology, 22.06.2019 12:00, dani19cano
The following function returns a string of length n whose characters are all 'x'. give the order of growth (as a function of n) of the running time. recall that concatenating two strings in java takes time proportional to the sum of their lengths. public static string f(int n) { if (n == 0) return ""; if (n == 1) return "x"; return f(n/2) + f(n - n/2); } options: a) constant b) logarithmic c) linear d) linearithmic e)quadratic f)cubic g) exponential
Answers: 2
image
Computers and Technology, 22.06.2019 23:00, brookerebman15
Which type of tab stop is most for weights and measurements?
Answers: 1
image
Computers and Technology, 22.06.2019 23:30, ansonhunter8891
What are listed in the vertical columns across the top of the event editor? a. file names b. conditions c. check marks d. action types
Answers: 1
Do you know the correct answer?
Consider the following two code segments. in both, assume that n is an integer variable that has bee...

Questions in other subjects: