Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
1 views7 pages

Unit 2 - Computational Thinking and Programming

The document outlines the steps of problem solving in computer programming, which include analyzing the problem, developing an algorithm, coding, and testing/debugging. It emphasizes the importance of algorithms as step-by-step instructions and introduces flowcharts and pseudocode as methods for representing algorithms. Additionally, it provides examples of pseudocode and flowchart creation for simple tasks like summing two numbers.

Uploaded by

sreyasmshr
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)
1 views7 pages

Unit 2 - Computational Thinking and Programming

The document outlines the steps of problem solving in computer programming, which include analyzing the problem, developing an algorithm, coding, and testing/debugging. It emphasizes the importance of algorithms as step-by-step instructions and introduces flowcharts and pseudocode as methods for representing algorithms. Additionally, it provides examples of pseudocode and flowchart creation for simple tasks like summing two numbers.

Uploaded by

sreyasmshr
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/ 7

Unit 2: Computational Thinking and

Programming

Introduction to Problem Solving


●​ Problem solving in computers means finding a problem, thinking of steps
(an algorithm) to fix it, and then writing a computer program to make it
work.

Steps for Problem Solving


●​ To identify the best solution to a difficult problem in a computer system, a
Problem Solving methodical approach is necessary.
●​ Problem Solving Steps are –
●​ Analysing the problem
●​ Developing an Algorithm
●​ Coding
●​ Testing and Debugging

Analyzing the problem:

●​ It is important to clearly understand a problem before we begin to find the


solution for it.
●​ If we are not clear about what is to be solved, then the software program
will not work properly.

Developing an Algorithm:

●​ Developing an algorithm is important before creating the program.


●​ An algorithm is a step-by-step process where we write the problem and the
steps of the programmes.
Coding:

●​ After the algorithm is completed, it must be translated into a form of


program.
●​ This program can be written using any programming language to produce
the desired outcome.

Testing and Debugging

●​ The developed programme needs to pass different parameters to produce


accurate output.
●​ This parameter can be tested using the testing and debugging method.
ALGORITHM

●​ An algorithm is a step-by-step set of instructions used to solve a


problem or do a task.
●​ The purpose of an algorithm is to act like a roadmap for solving a
problem.
●​ Before writing code, a programmer first makes an algorithm
(step-by-step plan). Without it, the programmer cannot clearly
understand the problem, and the program may not work as needed.

Representation of Algorithms
There are two common methods of representing an algorithm —flowchart and
pseudocode.

●​ A flowchart is a visual representation of the logic and control flow of


the program.
●​ Pseudocode is a structured way of writing an algorithm.

Flowchart — Visual Representation of Algorithms


●​ A flowchart is a visual representation of an algorithm.
●​ A flowchart is a diagram made up of boxes, diamonds and other shapes,
connected by arrows.
●​ Each shape represents a step of the solution process and the arrow
represents the order or link among the steps.
How to draw flowchart

Q. Draw a flowchart to find the sum of two numbers?

Q. Draw a flowchart to print the number from 1 to 10?


Pseudocode
●​ Pseudocode is a way to represent an algorithm in simple, plain language.​

●​ It looks like code but is not real programming code.​

●​ The word “pseudo” means “not real.”​

●​ It helps programmers plan and understand the steps before writing actual
code.​

●​ Pseudocode is written in a step-by-step manner, just like instructions.​

●​ It is easy to read and understand by both programmers and


non-programmers.​

●​ It does not follow strict syntax rules of any programming language.​

●​ It makes it easier to convert the steps into real code later.

Following are some of the frequently used keywords while writing pseudocode

●​ INPUT
●​ COMPUTE
●​ PRINT
●​ INCREMENT
●​ DECREMENT
●​ IF/ELSE
●​ WHILE
●​ TRUE/FALSE

Example

Write an algorithm to display the sum of two numbers entered by the user, using
both pseudocode and flowchart.
Pseudocode for the sum of two numbers will be –

input num1​
input num2​
COMPUTE Result = num1 + num2​
PRINT Result

Flowchart for this pseudocode or algorithm –

You might also like