100% found this document useful (1 vote)
98 views15 pages

Introduction To Programming

This document provides an introduction to programming concepts including: 1. It discusses computer systems, algorithms, flowcharts, and programs. Computer systems process instructions from programs but cannot determine logic on their own. Algorithms are solutions to problems that are language independent and have defined inputs, outputs, and finite processes. 2. Flowcharts provide a visual representation of algorithms to facilitate development and review of programs. Programs are algorithms expressed in a programming language with defined syntax and constructs. 3. It also covers programming concepts such as constants, variables, and arrays - which are containers that store similar data and can be accessed via index numbers.

Uploaded by

api-3712367
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
98 views15 pages

Introduction To Programming

This document provides an introduction to programming concepts including: 1. It discusses computer systems, algorithms, flowcharts, and programs. Computer systems process instructions from programs but cannot determine logic on their own. Algorithms are solutions to problems that are language independent and have defined inputs, outputs, and finite processes. 2. Flowcharts provide a visual representation of algorithms to facilitate development and review of programs. Programs are algorithms expressed in a programming language with defined syntax and constructs. 3. It also covers programming concepts such as constants, variables, and arrays - which are containers that store similar data and can be accessed via index numbers.

Uploaded by

api-3712367
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd

Introduction to Programming

Mehul Jain
Mumbai
darshan again
on
16 july
th
Overview
• Computer Systems: The Basics
• Algorithms
• Flowcharts
• Programs
Computer Systems
• Dumb machines that only
process instructions
(programs)
• Follow Garbage In
Garbage Out (GIGO)
principle
• Can’t differentiate into
correct/incorrect logic
• Problem solving tool
Under the hood
• Input: e.g.., Keyboard
and Mouse
• Processor: Central
Processing Unit
• Output: Monitor or a
Printer
Algorithms
• An Algorithm is a solution to a problem that is
independent of any programming language.
• Steps are essentially sequential in nature
• All Inputs and Outputs have to be specified
explicitly
• Have a start state and an end state (explicit
start and end points)
• For each input, a result should be generated
and that too in finite time
Use of algorithms
• Facilitates easy development of programs
• Iterative refinement
• Easy to convert it to a program
• Review is easier
Q Write an Algorithm to solve quadratic
equation (ax2 + bx +c =0) for Real Roots
• 0. START
• Read a, b and c //(non zero constants) (Input)
• Disc=b2-4ac //Calc. Discriminant (Process)
• If Disc>=0 Then Goto step 5 Else Goto step 7 //For Real Roots (Decision)
• X1= (-b+√Disc)/2a, X2= (-b-√Disc)/2a //Calculating Roots (Process)
• Write X1 and X2
• STOP
FLOWCHARTS: A PICTURE IS
WORTH A THOUSAND WORDS
• A flowchart is a
diagrammatic
representation of an
algorithm
• Normally the “flow” of
control is from top to
bottom
Q Draw a flowchart for the algorithm of the prev. example (quad. eqn)
START

Read a, b & c

Disc=b2-4ac

No
Disc>=0

Yes
X1= (-b+√Disc)/2a, X2= (-b-√Disc)/2a

Write X1 and X2

STOP
PROGRAM
• A program is an algorithm expressed in a
programming language
• Each language has a certain syntax and
has a variety of programming constructs
available for easier problem solving
• “Perfectly Optimal Code” is a Holy Grail
that has not many takers (abstraction v/s
user friendliness)
CONSTANTS & VARIABLES
• A constant is a constant
is a constant
• 23, 44, “NMIMS”, 65,
“Hello”, a.
• A Variable is a
Container for Constants
• Variables can change
2007
values during the
NMIMS
execution of the program
• e.g. a, num1,x
Arrays
• An array is a set of
identical variables
n
that contain similar
data
• Arrays have a fixed
size
• Index numbers are
A(1)
used to access the
A(n)
Array variables

You might also like