Programming Homework 3
Assign Date: 04-11-2024 Due Date: 04-11-2024
Modify the last program did in today's class.
Pre Task: Modify following statement:
n1 = rand(), n2 = rand(), n3 = rand();
n1 = rand() % 20, n2 = rand()% 20, n3 = rand()% 20;
Q1. Print numbers from min to max in one line. Run another loop and print numbers from max to min.
Q2. Print pair of numbers in separate lines starting from min, max. Increment min by one and decrement max by
one. Continue until they become equal or max becomes smaller than min
Q3. Print pair of numbers in separate lines starting from min, max. Increment min by one and decrement max by
one. Continue until max becomes equal to the original value of the min.
Hint: Use an extra variable to store original value of min to put the condition in the loop
Q4. Print numbers from min to max. Also compute and print their sum and average (in float).