You are on page 1of 3
1. Consider the followin, m. / Assume nis a g ger being power of © 32 count —0 ring while x >1do $?! St ae begin rea/2 4 L ' count = count +10 fo > end output count (a) Give the trace table and the output of the above algorithm when n = 32. feeps Nelving Sb oN AN Catt Stores iow ery Hewes th. hneppens dun ned, 2» Lb, ot 2/2 » ¢ 2. By onl, \slyak once te ga fo be S?. True SMe? n= 3) Tevetion | on. bere | Cour | 4 cyber oe Looe AY os \ ar [6 (6 et ee etc ce = Me PP = ld Ii- ~ & w& ral, how many times the while loop is executed for input_n_being a positive £2 (e.g., when m = 2,4,8, 16,92,644,.)? 0 Ss Ca 2 ny % 672+ 2 (2) cease im EITC {vn ele. ~ W 8 TS SH ee a nels? [6/229 LL) 2 =16 nrd23 32) 290 65) Lai, a bomp tin be ally Ito of te pete gy 21 ou K He Heaton. L)_ % Write a pseudo code of whileloop to find the sum ofall uulipis of 8 bet 2 gud 9 Jase, You cn ase tht Og 1 is a prime number or not. Hints: (1) We can use a loop to check for each integer i smaller than « whether 2 is divisible by i (2) If we want to make it quicker, we can stop carlier, the question is when should we a ie ee Es 7). four & fulst grime - true b a = 2 then paced. E fie tdilt poo ¥ fre AMD ea pe h62=0 thes pour & tvee pine & yale R@R& Encl Durpr prime

You might also like