PyCodePro

Previously LP16 - A website that teaches Python programming language through interactive tutorials, practice exercises, and real-world projects.

PROGRAM LOGIC DEVELOPMENT

PROGRAM LOGIC DEVELOPMENT


Algorithm

It is a step – by – step procedure ( well – defined instructions ) to solve a given problem .

The algorithm to find the remainder of given two number is –

1 – input first number

2 – input second number

3 – Divide first number with second number and store the remainder as third number .

4 – Display the result which is third number

An algorithm is a set of ordered and finite steps to solve a given problem .

Another example – using the same logic determine the first number is divisible by second number or not

1 – input first number

2 – input second number

3 – Divide first number with second number and store the remainder as third number

4 – check if the third number is zero ( 0 )

a ) if yes , display ‘ the first number is divisible by second number ’

b ) if no , display ‘ the first number is not divisible by third number ’

FLOW CHARTS

The flow chart is the graphical representation of algorithm . the flowchart shows the different subtasks with different symbol .

➡️  use data symbol for input / output ( I /  o) operations ( taking input and showing output )

➡️  use process symbol for any type of computation and internal operations like – initialization calculation e . t . c .

➡️  use subprocess symbol to invoke a procedure written already .

The flow chart for the above algorithm ( determine if the first number is divisble by second number or not )

START
⬇️

Input first number ( a )
⬇️

Input second number ( b )
⬇️

remainder = a % b
⬇️

is remainder == 0 ➡️ no ➡️ display the fist number is not divisible by second number
⬇️

Yes
⬇️

display the first number is divisible by
 second number
⬇️

stop


with the flow chart , a programmer can pictorially view the subtasks of an algorithm and the order their execution

In the next blog we will cover the another most important topic of the python which is –
The IF statement of python
thankyou for visiting keep visiting enjoy !!!

PROGRAM LOGIC DEVELOPMENT PROGRAM LOGIC DEVELOPMENT Reviewed by Learn Python on November 16, 2019 Rating: 5

No comments:

Powered by Blogger.