0% found this document useful (0 votes)
93 views3 pages

Mission:: Program Development Life Cycle (PDLC) Problem Solving Concepts (Part 2)

The document describes a lab assignment on using flowcharts and the program development life cycle (PDLC) to solve problems algorithmically. It includes 8 questions that require designing programs using flowchart symbols like rectangles for assignments, diamonds for logical operations, and parallelograms for input/output. Many of the questions involve calculating values using repetition, such as computing powers or factorials. The tasks range from simple programs that output sequences to ones that accept multiple inputs and compute outputs like averages.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
93 views3 pages

Mission:: Program Development Life Cycle (PDLC) Problem Solving Concepts (Part 2)

The document describes a lab assignment on using flowcharts and the program development life cycle (PDLC) to solve problems algorithmically. It includes 8 questions that require designing programs using flowchart symbols like rectangles for assignments, diamonds for logical operations, and parallelograms for input/output. Many of the questions involve calculating values using repetition, such as computing powers or factorials. The tasks range from simple programs that output sequences to ones that accept multiple inputs and compute outputs like averages.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Trimester 1, 2019/20 PSP0101 - Problem Solving and Program Design

Lab03
Program Development Life Cycle (PDLC)
Problem Solving Concepts (Part 2)

Mission:
1. Experience PDLC by solving problems algorithmically using flowcharts.

Overview
Last week, we have solved many problems using flowchart, but without much emphasis on
the Repetition structure. This week, we put more emphasis on problems that require the
Repetition structure to solve.

Problems
We assume that the programs will be run on a machine as specified in the previous lab,
whereby the machine can only perform a limited set of instructions in some flowchart
symbols, as indicated below:

Rectangle symbol:
1. Assignment only :
2. Assignment with Unary operation :
3. Assignment with Binary operation : ,( { })

Diamond symbol:
1. Logical operations : ,( { })

Parallelogram symbol (i.e. for I/O):


1. Input operation : INPUT
2. Output operation : OUTPUT

and are expressions. An expression can be a constant, an unknown, a unary operation,


or a binary operation.

can only be an unknown (i.e. not a constant nor an expression).

The word INPUT and OUTPUT may be replaced with any relevant but unambiguous words
(e.g. GET or ACCEPT for INPUT, SHOW or DISPLAY for OUTPUT)

KWBAN (William) 1
Trimester 1, 2019/20 PSP0101 - Problem Solving and Program Design

Question 1
Design a program that accepts two positive integers B and E, calculates B power of E using
repetition, and outputs the result.

Question 2
Design a program that accepts a positive integer N and compute the sum of all the numbers
below N and above 0.
e.g. Given 5, output: 10 (since 4+3+2+1 = 10)
Given 9, output: 36 (since 8+7+6+5+4+3+2+1 = 36)

[ TAKE HOME EXERCISE: Question 2 can be solved without using Repetition structure. Do you know
how? ]

Question 3
Modify your program in Question 2 such that it computes (N-1)!, the factorial of N – 1.

e.g. Given 5, output: 24 (since 4x3x2x1 = 24)


Given 9, output: 36 (since 8x7x6x5x4x3x2x1 = 40320)

Question 4
Design a program that accepts a positive integer N. Then, the program shows a sequence
formed with | |, where .

e.g. Given 2, output: 21012


Given 3, output: 3210123
Given 5, output: 54321012345

Question 5
Design a program that accepts a positive integer N. Then, the program accepts N number of
quiz marks in real numbers, and outputs the average of these quiz marks.

Question 6
Design a program that accepts ten numbers and show the largest number among them.

KWBAN (William) 2
Trimester 1, 2019/20 PSP0101 - Problem Solving and Program Design

Question 7
Design a program that accepts two positive integers A and B, and shows a sequence from A
to B, inclusive of A and B.

e.g. Given A = 3, B = 5 output: 345


Given A = 4, B = 1 output: 4321

Question 8
Design a program that accepts a non-zero positive integer N. If N is an ODD integer, the
program outputs a sequence of alternating 0s and 1s that starts from 1. Otherwise, the
program outputs a sequence of alternating 0s and 1s that starts from 0. In either case, the
length of the sequence must be N.

e.g. Given N = 3, output: 101


Given N = 6, output: 010101

Hint: Let be .
Perform updates to
Perform again changes back to

KWBAN (William) 3

You might also like