Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Computer Programming
15 Computer Systems Engineering – Second Semester
• Problem analysis tools help you analyze the problem to have a clear picture
of the problem.
• They help you identify the problems and their causes at the beginning.
• The problem analysis tools that we will be using to solve problem are:
Algorithm:
• The input may be given by the user from input devices like, keyboard,
mouse, scanner etc.
• The output may be in the form of the presenting the results on the monitor
screen, printer or any other output device.
• The processing section specifies two things: processing items and algorithm.
• The algorithm is the step by step processing procedure to solve that task.
• All the symbols are then connected with arrows to show the flow of the
process.
Input-Output
Shows an input or output instruction.
(Parallelogram)
Algorithm:
Step 01: Start
Step 02: Input width and height from the user
Step 03: Calculate area as: area = width * height
Step 04: Print area
Step 05: End
Algorithm:
Step 01: Start
Step 02: Input radius from the user
Step 03: set PI = 3.1415
Step 04: Calculate area as: area = PI * radius^2
Step 05: Calculate circumference as:
circumference = 2 * PI * radius
Step 06: Print area and circumference
Step 07: End
Zoom-In to have a
clear view
Algorithm:
Step 01: Start
Step 02: Input number from the user
Step 03: if (number MOD 2) == 0 then GOTO Step 04
else GOTO Step 05
Step 04: Print “Number is even” GOTO Step 06
Step 05: Print “Number is odd”
Step 06: End
Algorithm:
Step 01: Start
Step 02: Input number from the user
Step 03: if (number > 0) then GOTO Step 04 else
GOTO Step 05
Step 04: Print number
Step 05: End
Algorithm:
Step 01: Start
Step 02: Input num1, num2 and num3 from the user
Step 03: if (num1> num2 and num1 > num3) then GOTO
Step 05
Step 04: if (num2> num1 and num2 > num3) then GOTO
Step 06 else GOTO Step 07
Zoom-In to have a
clear view
Algorithm:
Step 01: Start
Step 02: Input N from the user
Step 03: Set i = 1, sum = 0
Step 04: Repeat Step 05 to Step 06 while i <=N
Step 05: Set sum = sum + i
Step 06: Set i = i + 1
Step 07: Print sum
Step 08: End
Algorithm:
Step 01: Start
Step 02: Input N from the user
Step 03: Set i = 1
Step 04: Repeat Step 05 to Step 06 while i <=N
Step 05: Print 2*i
Step 06: Set i = i + 1
Step 07: End
Algorithm:
Step 01: Start
Step 02: Input N from the user
Step 03: Set i = 1
Step 04: Repeat Step 05 to Step 06 while i <=N
Step 05: Print i * 5
Step 06: Set i = i + 1
Step 07: End
Algorithm:
Step 01: Start
Step 02: Input N from the user
Step 03: Set i = 5
Step 04: Repeat Step 05 to Step 06 while i <=N*5
Step 05: Print i
Step 06: Set i = i + 5
Step 07: End
Algorithm:
Step 01: Start
Step 02: Input N from the user
Step 03: Set i = N , factorial = 1
Step 04: Repeat Step 05 to Step 06 while i >1
Step 05: Set factorial = factorial * i
Step 06: Set i = i - 1
Step 07: Print factorial
Step 08: End
Algorithm:
Step 01: Start
Step 02: Input N from the user
Step 03: Set i = 2 , isPrime = true
Step 04: Repeat Step 05 to Step 06 while i < N
Step 05: if (N MOD i) = 0 then isPrime = false GOTO Step 07
Step 06: Set i = i + 1
Step 07: if isPrime = true GOTO Step 08 else GOTO Step 09