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 proper control instruction to calculate y(x) from the equation (10 marks)
-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?
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
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
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
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!