Search for notes by fellow students, in your own course and all over the country.
Browse our notes for titles which look like what you need, you can preview any of the notes via a sample of the contents. After you're happy these are the notes you're after simply pop them into your shopping cart.
Title: Basic Programming Concepts
Description: Basic Programming Concepts & Programming & Data Structures
Description: Basic Programming Concepts & Programming & Data Structures
Document Preview
Extracts from the notes are below, to see the PDF you'll receive please use the links above
Basic Programming Concepts
CS10001: Programming & Data Structures
Pallab Dasgupta
Professor, Dept
...
& Engg
...
of CSE, IIT KGP
Some Terminologies
• Algorithm / Flowchart
– A step-by-step procedure for solving a particular problem
...
• Program
– A translation of the algorithm/flowchart into a form that can be
processed by a computer
...
high-
Dept
...
– The value of a constant do not change
...
Dept
...
• How does memory look like (logically)?
– As a list of storage locations, each having a unique address
...
– A variable is like a bin
• The contents of the bin is the value of the variable
• The variable name is used to refer to the value of the variable
• A variable is mapped to a location of the memory, called its
address
Dept
...
of CSE, IIT KGP
Every variable is
mapped to a particular
memory address
Variables in Memory
Instruction executed
Variable X
X = 10
Dept
...
)
Variable
Instruction executed
20
?
Y = 15
20
15
X=Y+3
18
15
Y=X/6
Dept
...
Floating• Examples: 3
...
0, -12345
...
of CSE, IIT KGP
Data Types (contd
...
of CSE, IIT KGP
Problem solving
• Step 1:
– Clearly specify the problem to be solved
...
• Step 3:
– Convert flowchart (algorithm) into program code
...
• Step 5:
– Execute the program
...
of CSE, IIT KGP
Flowchart: basic symbols
Computation
Input / Output
Decision Box
Start / Stop
Dept
...
Flow of
control
Connector
Dept
...
of CSE, IIT KGP
Example 2: Larger of two numbers
START
READ X, Y
YES
IS
X>Y?
NO
OUTPUT X
STOP
Dept
...
of CSE, IIT KGP
NO
Max = Y
IS
Max > Z?
NO
OUTPUT Z
STOP
Example 4: Sum of first N natural numbers
START
READ N
SUM = 0
COUNT = 1
SUM = SUM + COUNT
COUNT = COUNT + 1
NO
IS
COUNT > N?
YES
OUTPUT SUM
STOP
Dept
...
of CSE, IIT KGP
Example 6: SUM = 1
...
3 + 3
...
of CSE, IIT KGP
Example 7: Computing Factorial
START
READ N
PROD = 1
COUNT = 1
PROD = PROD * COUNT
COUNT = COUNT + 1
NO
IS
COUNT > N?
YES
OUTPUT PROD
STOP
Dept
...
of CSE, IIT KGP
Example 8: Computing ex series up to 4 decimal places
START
READ X, N
TERM = 1
SUM = 0
COUNT = 1
SUM = SUM + TERM
TERM = TERM * X / COUNT
COUNT = COUNT + 1
NO
IS
TERM < 0
...
of CSE, IIT KGP
Example 10: Roots of a quadratic equation
ax2 + bx + c = 0
TRY YOURSELF
Dept
...
of CSE, IIT KGP
Ex
A
B
C
D
P
F
Grade Computation (contd
...
of CSE, IIT KGP
NO
MARKS ≥ 80?
YES
OUTPUT “A”
STOP
NO
MARKS ≥ 70?
YES
OUTPUT “B”
STOP
NO
A
NO
A
MARKS ≥ 60?
YES
MARKS ≥ 50?
YES
NO
MARKS ≥ 35?
NO
YES
OUTPUT “C”
OUTPUT “D”
OUTPUT “P”
OUTPUT “F”
STOP
STOP
STOP
STOP
Dept
Title: Basic Programming Concepts
Description: Basic Programming Concepts & Programming & Data Structures
Description: Basic Programming Concepts & Programming & Data Structures