Starting from:

$30

CSE114-Labwork2 Solved

LABWORK 2 

 
Question 1: 

Write a program to print the number pattern below.  

  

Every row contains double number of columns compare to previous one. Each column contains an integer from 1 to 9, when the number reaches 10 it restarts to 1.

 

The main function :

⚫  Ask the user to enter the number of rows 

⚫  Construct a for loop for the number of rows. 

⚫  Construct another for loop for the column values. 

⚫  Double the total number of columns before before exiting the outer loop. 
 

Examples: 

 
Question 2: 

Write a program that asks the user to enter limited number of integers. Numbers entered can be negative, positive or zero. Count the positive numbers, negative numbers and zeros and display them as the output.

 

The main function :

⚫  Ask the user to enter the limit. 

⚫  Construct a while loop and get the numbers from the user. 


⚫  Count the positive numbers, negative numbers and zeros.

 

⚫ Exit the loop and print the output. 

 

Examples: 

More products