1. Write down an algorithm to count and print the odd numbers from 1 to 100.(8 marks) 2. Write an algorithm by using a p
Posted: Thu May 26, 2022 9:56 am
-2x U EGYPT 1 2 x ≥ 0 y(x) = 1 2x x < 0 2 3. Write an algorithm that works according to the following specifications: (8 marks) a) Declare and create a list L[]of n elements and prompt the user to enter the size for the list. b) Calculate and print the average of the values entered in the List L[] by using loop. 4. What is the output from this code segment? (3 marks) Input x = 1; Input y = 0; if (x > 0 || y < 0) { } Else { } Print ('x=',x,'y=',y) 5. For the following algorithm: (5 marks) input m if m<0 then {m = -m} while( (m<=5)) { m = m + 1 } a) What is the value of (m) to skip the loop? b) What is the value of (m) to enter the loop only once?