Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
100% found this document useful (1 vote)
1K views

Practice Problems 01 Pseudocodes and Flowcharts

The document contains 21 practice problems involving writing pseudo-code and flowcharts for programs that perform various calculations and conditional checks. The problems cover topics like loops, calculations, conditional logic, user input/output, and more. Students are asked to write pseudo-code and provide flowcharts for programs that solve problems like calculating sums, products, averages, determining grades or probation status, finding maximum/minimum values, and comparing numbers.

Uploaded by

Jahidul Hasan
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
1K views

Practice Problems 01 Pseudocodes and Flowcharts

The document contains 21 practice problems involving writing pseudo-code and flowcharts for programs that perform various calculations and conditional checks. The problems cover topics like loops, calculations, conditional logic, user input/output, and more. Students are asked to write pseudo-code and provide flowcharts for programs that solve problems like calculating sums, products, averages, determining grades or probation status, finding maximum/minimum values, and comparing numbers.

Uploaded by

Jahidul Hasan
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 3

CSE 110: Programming Language 1

Spring 2008

Practice Problems from Lecture 2 (Pseudo-code, Flow charts and


Structure chart)

For all problems, write the pseudo-code, draw the flowchart and the structure
chart.

1. Write the pseudo-code and draw the flowchart of a program that prints the following
sequences of values in loops:
a) 24, 18, 12, 6, 0
b) -10, -5, 0, 5, 10, 15
c) 18, 27, 36, 45, 54

2 Write the pseudo-code and draw the flowchart of a program that calculates and prints
the sum of the even integers from 10 to 60.

3. Write the pseudo-code and draw the flowchart of a program that calculates and prints
the product of the odd integers from 3 to 13.

4. Write the pseudo-code and draw the flowchart of a program that will calculate the
value of y if the expression of y is as follows (n is the input):

1 2 3 4 n
y     ............. 
1 3 5 7 (2n  1)

5. Write the pseudo-code and draw the flowchart of a program that will calculate the
value of y if the expression of y is as follows (n is the input):

y  12  2 2  3 2  4 2  5 2 ............ n 2

6. Write the pseudo-code and draw the flowchart of a program that compute and display a
person’s weekly salary as determined by the following conditions:
If the hours worked are less than or equal to 40, the person receives Tk200.00 per
hour, else the person receives Tk8000.00 plus Tk300.00 for each hour worked
over 40 hours.
(Hint: The program should request the hours worked as input and should display the
salary as output).

7. A student will be placed on probation if his CGPA falls below 2.0 in an exam. Write
the pseudo-code and draw the flowchart of a program that reads a student’s CGPA from
the standard input and prints on the standard output whether he is on probation or not.

8. Write the pseudo-code and draw the flowchart of a program that reads marks of ten
courses and prints the maximum, minimum and average of those ten marks.

1
9. Suppose the following expressions are used to calculate the values of L for different
values of S:

L = 3000  125S 2 if S  100


12000
if S  100
4   S 2 14900
L=

Write the pseudo-code and draw the flowchart of a program that reads a value of S and
then calculates the value of L.

10. Write the pseudo-code and draw the flowchart of a program that reads the value of n
and calculates the value of y if the expression of y is as follows:

y 3  13  2 3  33  4 3  5 3  6 3  ............ n 3

11. Write the pseudo-code and draw the flowchart of a program that reads the values for
the three sides x, y, and z of a triangle, and then calculates its area. The area is calculated
as follows: area  s ( s  x)( s  y )( s  z )
x yz
where s is .
2

12. Draw the flowchart and write the pseudo-code for the following:
1) Ask the user to enter his/her name.
2) Ask the user to enter a Number
3) Display the name of the user, number of times specified in the second step.
Example: If the user enters “John” and 6, your program should print the name John six
times.

13. Draw the flowchart and write the pseudo-code for the following:
Take seven numbers input from the user and find the maximum and the average.

14. a) Do problem 13 to find the minimum and the average of those seven numbers.
b) Find the maximum and the average of the odd numbers entered by the user. [If the
user enters even numbers ignore them]

15. Draw the flowchart and write the pseudo-code for the following:
 Ask the user to enter a Number
 Display the summation of multiples of 7 up to that number.
Example: If the user enters 50, your program should print 196. (because: 7 + 14 + 21 +
28 + 35 + 42 + 49 = 196).

16. Write a complete pseudo-code and the flowchart of a program, which adds all the
multiples of 7 and 9 up to 300.

2
17. Write a Flowchart and Pseudocode for the following:
Ask the user to enter ten numbers then display ONLY the total and the average of
the odd numbers among those ten numbers.
[Hint: Example Input: 1 2 3 4 5 6 7 8 9 10 and Example Output: Total is 25 and Average
is 5 (i.e., Total is 25 = (1+3+5+7+9) and Average is 25/5 = 5)]

18. Solve problem 17 for even numbers instead of odd numbers.

19. Solve problem 17 for numbers that are multiples of 4, instead of odd numbers.

20. Write a Flowchart and Pseudocode for the following:


A program that takes as input your final marks (Out of 100) and shows as output
the letter grade.
90 - 100 = A (4.0) Excellent
85 - <90 = A- (3.7)
80 - <85 = B+ (3.3)
75 - <80 = B (3.0) Good
70 - <75 = B- (2.7)
65 - <70 = C+ (2.3)
60 - <65 = C (2.0) Fair
57 - <60 = C- (1.7)
55 - <57 = D+ (1.3)
52 - <55 = D (1.0) Poor
50 - <52 = D- (0.7)
<50 = F (0.0) Failure

21. Draw the flowchart and write the Pseudocode for the program that asks the user to
enter two numbers and determine and display the bigger number.

You might also like