An algorithm for the problems will be published later.
1. Write an algorithm (pseudocode or flowchart) for a program that read 10 integers. Find the maximum and minimum number among the 10 (hint: use selection statements together with looping statements).
2. A Book Publisher offers
discount to customers on the basis of customer type and number of copies
ordered as shown below:
Customer
Type
|
Number of
Copies Ordered
|
% of
Discount
|
Book Seller
|
More than 10
|
25
|
Less than or equal to 10
|
15
|
|
Library
|
More than 5
|
20
|
Less than or equal to 5
|
10
|
Customer number, name, type, book number, number of
copies ordered and unit price are given as input. Draw a flowchart to calculate
the net amount of the bill for each customer and print it.
3. (Counting positive and negative numbers and computing the
average of numbers) Write a program that reads an unspecified number of
integers, determines how many positive and negative values have been read, and
computes the total and average of the input values. Your program ends with the
input 0. Display the average as a floating-point number. (For example, if you
entered 1, 2, and 0, the average
should be 1.5.)
4.Write a test program that prompts the user to enter the
investment amount (e.g., 1000) and the interest rate (e.g., 9%), and print a
table that displays future value for the years from 1 to 30, as shown below:
The amount invested: 1000
Annual interest rate: 9%
Years Future
Value
1 1093.8
2 1196.41
...
29 13467.25
30 14730.575. (Summing a series) Write a program to sum the following series:
6. A nested loop is a loop within a loop, an inner loop within the body of an outer one. How this works is that the first pass of the outer looptriggers the inner loop, which executes to completion. Then the second pass of the outer loop triggers the inner loop again.
No comments:
Post a Comment