Starting from:

$25

CSE1321-Assignment 1 Solved

Problem 1: Write pseudocode algorithm that performs the following:

 

a)    Read in 5 separate numbers from the user.  

b)    Calculate the average of the five numbers.  

c)    Find the smallest (minimum) and largest (maximum) of the five entered numbers.  

d)    Write out the results found from steps b and c with a message describing what they.

 

The algorithm output is as shown below.

 

 Sample Output: 

 

Average of all numbers = 56 

Maximum number: 68 

Minimum number: 23 

 

 

Program 2: Write pseudo code that will add all the even numbers from 0 up to a user defined stopping point (inclusive if even). The algorithm output is as shown below.

 

 Sample Outputs: 

 

Stopping point: 12 

Sum of all evens = 42 

 

Stopping point: 9 

Sum of all evens = 20 

 

 

Program 3: Write pseudocode algorithm that tells someone how old they will be in 20 years from today. The algorithm output is as shown below.

 

 Sample Outputs: 

 

Your age today = 19 

Your age in 20 years = 39 

 

Your age today = 34 

Your age in 20 years = 54 

 

Page 1 of 2 

Program 4: Write pseudocode algorithm that performs the following task: Ask a user to enter a number. If the number is between 0 and 10, write the word “Blue”. If the number is between 10 and 20, write the word “Red”. If the number is between 20 and 30, write the word “Green”. If it is any other number, write the message “This is not a correct color option”. The algorithm output is as shown below.

 

 Sample Outputs: 

 

You entered:  15 

Your color:   Red 

 

You entered:  41 Your color:   This is not a correct color option. 

 

 

Program 5: Write pseudocode algorithm to add the prices of an order of fries, a burger, and a drink, calculate the tax (assume 10%), and tell the customer their total. The algorithm output is as shown below.

 

 Sample Output: 

 

Fries price:   3 dollars 

Burger price:  6 dollars 

Dink price:    1 dollar 

Tax:           1 dollar 

Total cost:    11 dollars 

 

More products