Sunteți pe pagina 1din 2

Problem Solving Using Programmed Solutions

For each of the following problems, design the solution using pseudocode and flowcharts:

1. You are to design an algorithm that will receive an integer from the screen, add 5 to it,
double it, subtract 7 from it, and display the final number to the screen.

2. A home mortgage authority requires a deposit on a home loan according to the following
schedule:

Loan amount $ Deposit


less than 25,000 5% of loan value
25,000 - 49,999 $1250 + 10% of loan
50,000 - 100,000 $5000 + 25% of loan

Loans in excess of $100,000 are not allowed. Design a program, which will read a loan
amount and compute and print the required deposit. The program should terminate when an
invalid loan amount is entered by the user.

Sample input-output:
Enter loan amount (Key in –999 to end) : 10000
The deposit is : $500.00

Enter loan amount (Key in –999 to end) : 25000


The deposit is : $3750.00

Enter loan amount (Key in –999 to end) : -999

3. Design in pseudocode or flowchart an interactive program that reads a low value, a high
value, and an increment value, ensures that the low value is less than or equal to the high
value, and computes and prints a table of square and cube values from low to high at
increments of increment.

Sample input-output :

Low value : 1
High value : 5
Increment : 1

Value Square Cube


1 1 1
2 4 8
3 9 27
4 16 64
5 25 125
4. Design a program that will read 10 integers from the user and store them in an array called
val[]. The program should then determine how many of the numbers entered by the user are
even.
Sample input-output :
Key in 10 numbers : 1 2 3 4 5 6 7 8 9 10
The total number of even numbers entered are : 5

5. Design a program that will read a series of integers from the user and store them in an array
called num[]. The program should then calculate and display the product of all integers
entered by the user.

Sample input-output :
Enter total numbers to read : 5
Key in 5 numbers :
365 47

The product : 2520

6. Design an algorithm that will read an array of 200 characters and display to the screen a
count of the occurrences of each of the five vowels (a, e, i, o, u) in the array.

S-ar putea să vă placă și