0% found this document useful (0 votes)
52 views

Chapter-1-Introduction Programming and Problem Solving Concepts

The document provides an introduction to programming and problem solving concepts. It defines a computer and its basic components. It discusses the relationship between hardware and software, describing system software and application software. It introduces programming languages at different levels from machine language to high-level languages. It defines algorithms and their characteristics. Finally, it discusses flowcharts as a graphical representation of algorithms and provides examples of algorithms and flowcharts.

Uploaded by

twisha1605
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views

Chapter-1-Introduction Programming and Problem Solving Concepts

The document provides an introduction to programming and problem solving concepts. It defines a computer and its basic components. It discusses the relationship between hardware and software, describing system software and application software. It introduces programming languages at different levels from machine language to high-level languages. It defines algorithms and their characteristics. Finally, it discusses flowcharts as a graphical representation of algorithms and provides examples of algorithms and flowcharts.

Uploaded by

twisha1605
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 35

Chapter-1

Introduction to Programming and Problem Solving Concepts


Introduction
 Computer :
 A computer is a device that can accept human instruction,
processes it, and responds to it.
or
 A computer is a computational device that is used to process the
data under the control of a computer program. Program is a
sequence of instructions along with data.
 The basic components of a computer are:
 Input unit
 Central Processing Unit(CPU)
 Output unit
Introduction
 Computer :
Introduction

 The CPU is further divided into three parts-


 Memory unit
 Control unit
 Arithmetic Logic unit

 CPU is called the brain of computer because it accepts data,


provides temporary memory space to it until it is stored(saved)
on the hard disk, performs logical operations on it and hence
processes(here also means converts) data into information.
Introduction
 A computer consists
 Hardware
 Software
 Hardware : Physical parts of computer system
 Input device - to accept data
 Processor - to process data
 Output device - to output result of program
 Memory - to store data /program. It can be primary memory (RAM) and
secondary memory (hard disk)
Introduction
 Software is a set of programs that performs multiple tasks together.
 An operating system is also software (system software) that helps
humans to interact with the computer system.
 Program is a set of instructions given to a computer to perform a
specific operation.
 Computer is a computational device that is used to process the data
under the control of a computer program.
 While executing the program, raw data is processed into the desired
output format.
Software

 A computer program that includes logical instructions used for


performing a particular task using hardware components.
 Types :
 System software
 Application software
Software – Hardware Relationship
 Fig 1.6
Software
 System Software
 Manages and controls hardware components.
 Responsible for appropriate functioning of hardware as well as
application software on computer.
 Includes general program that are written to provide an
environment for developing new application program.
 Examples:
 Operating system
 Device drivers
Software
 Application Software
 Executed on system software.
 Designed for application specific task and known as end-user
program.
 Unable to run without system software.
 Examples
 Ms-Office,
 Open-Office,
 Acrobat Reader,
 Visual Studio etc…
Programming Language

 Computer program : a set of instructions


 Instruction are written to tell
 What operation to perform
 Where to locate data
 How to present results
 When to make certain decisions

 Language used in communication of instructions is known


as Programming language.
Programming Language
 Three levels of programming languages
 Machine language (Low Level Language)
 Assembly (symbolic) language (Mid Level Language)
 Procedure-oriented language (High Level Language)
Programming Language
 Machine language (Low Level Language)
 Computer is made up of electronics devices.
 Computer can understand only pulse or no-pulse.
 All instructions-data should be written in binary (1/0) form.
 Binary code is called machine-code or machine language.
 Machine specific.
 Also known as first generation language.
Programming Language
 Assembly language (Mid-level Language)
 Reduces programming complexity and provide standardization in
building application.
 Known as Second-generation language.
 0/1 of machine language is replaced with mnemonics code.
 To execute assembly program, ‘Assembler (system s/w)’ is required.
 Advantages
 Easy to debug as it is easy to locate and identify syntax error.
 Easier to build application using assembly language as compared to
machine language.
 Operates efficiently.
Programming Language
 High Level Language
 Simplifies programming tasks by reducing number of computer
operation detail that has to be specified.
 More abstract, easier to use, portable across platforms as compared
to low level languages.
 To execute high level program, ‘Compiler (system s/w)’ is
required.
 Examples
 C, C++,
 Java, Python etc…
Programming Language
High Level Language Low Level Language
It can be considered as a programmer- Known as machine level language.
friendly language. Considered as a machine-friendly
language.
Understood easily by the programmer / Understood easily by the machine.
user.
Easy to debug. Difficult to debug.
Simple in terms of maintenance Maintenance is also complex.
Portable, can be run on
different Not portable. depends on the machine;
platforms. hence it can't be run on different
platforms.
It is less memory efficient, i.e., it It consumes less memory.
consumes more memory in comparison to
low-level languages.
Examples of high level languages include No Example
C, C++, Java, Python.
Prepared By Dr. Dhruti Sharma, IT SCET
Problem Solving
 It is the process of solving a problem in a computer
system.
 Steps
 Developing the algorithm
 Drawing the flowchart
Algorithms
 Algorithm :
 Sequence of steps specifying the tasks to be performed.
 Set of rules to be followed in calculations or other problem-
solving operations.
Algorithms
 Characteristics of Algorithm :

 Clear and Unambiguous: Algorithm should be clear and unambiguous.


Each of its steps should be clear in all aspects and must lead to only one
meaning.
Algorithms
 Characteristics of Algorithm :

 Well-Defined Inputs: If an algorithm says to take inputs, it should be well-


defined inputs.
Algorithms
 Characteristics of Algorithm :

 Well-Defined Outputs: The algorithm must clearly define what output will
be yielded and it should be well-defined as well.
Algorithms
 Characteristics of Algorithm :

 Finite-ness: The algorithm must be finite, i.e. it should not end up in an


infinite loops or similar.
Algorithms
 Characteristics of Algorithm :

 Feasible: The algorithm must be simple, generic and practical, such that it
can be executed upon with the available resources. It must not contain some
future technology, or anything.
Algorithms
 Characteristics of Algorithm :

 Language Independent: The Algorithm designed must be language-


independent, i.e. it must be just plain instructions that can be implemented in
any language, and yet the output will be same, as expected.
Algorithms

 Advantages of Algorithm
It is easy to understand. :
 Algorithm isgiven
a step-wise representation of a
 solution
In to
Algorithma the problem.
problem is broken down into
smaller pieces
programmer to of
 Disadvantages
or steps
convert hence,
it into it
an is easier
actual for
program the
.
 Writing Algorithm :
an algorithm takes a long time so it is
 time-consuming.
Branching and Looping statements are difficult to
show in Algorithms.

 Language Independent: The Algorithm designed must be language-independent, i.e. it must be just plain instructions that can be implemented in any language, and yet the output will be same, as expected.
Algorithms
 Algorithm to add two numbers
 Step1: Start
 Step2: Accept first number
 Step3: Accept second number
 Step4: Add these two number
 Step5: Display result
 Step6: Stop
Flowcharts
 Flowcharts are the graphical representation of the data or the
algorithm.
 It displays step-by-step solutions to a problem, algorithm, or process.
 It describes the sequence and flow of control and information within
the process.
 It uses different symbols for depicting different activities.
Flowcharts Symbols
Flowcharts
 Design rules
 It must begin with ‘start’ and end with ‘stop’ symbol.
 Process flow should be either in top-down or from left-right.
 Instruction must be crisp and concise.
 Arrows must be aligned properly.
 Connectors should be avoided.
 Process/action must have exactly one input and one output arrow.
Flowcharts
 Advantages
 It helps to understand flow of program control.
 Program development will be easier following flowchart.
 It works well for small program design.
 Disadvantages
 For large program, flowchart might become complex and
confusing.
 Modification of flowchart is difficult.
 Preparing flowchart is tedious and time-consuming.
Algorithm-Flowchart

 Algorithm and Flowchart to add two numbers.


Algorithm-Flowchart
 Algorithm and Flowchart to find maximum of two numbers.
Algorithm-Flowchart
Example : Print 1 to 20

• Algorithm
• Step 1: Initialize X as 0,
• Step 2: Increment X by 1,
• Step 3: Print X,
• Step 4: If X is less than 20
then go back to step 2.
Practice Problem
 Find Area of Circle
 Calculate the average of 3 numbers
 Calculate the simple interest
 Calculate the sum of integers 1 to 100
 To find sum of all even numbers upto ‘n’

You might also like