0% found this document useful (0 votes)
2 views42 pages

Introduction

The document provides an introduction to computers and programming, detailing the components of a computer system, including the CPU, memory, input/output devices, and software types. It covers programming languages, algorithms, and flowcharts, illustrating how to solve problems systematically. Additionally, it includes examples of algorithms and flowcharts for various tasks such as calculating sums and determining maximum values.

Uploaded by

fatimahtimalia01
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views42 pages

Introduction

The document provides an introduction to computers and programming, detailing the components of a computer system, including the CPU, memory, input/output devices, and software types. It covers programming languages, algorithms, and flowcharts, illustrating how to solve problems systematically. Additionally, it includes examples of algorithms and flowcharts for various tasks such as calculating sums and determining maximum values.

Uploaded by

fatimahtimalia01
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 42

INTRODUCTION TO COMPUTER AND PROGRAMMING

MIHIR MISHRA
1
INTRODUCTION
 What is computer?
 It is an electronic device which accept data from out side world ( standard input devices)
and manipulates or process it at high speed according to instructions given.
 It has memory to store large amount of data, can process it in accurate form with high
speed by using power full processor.
 Computer is also called data processor because it can store, process and retrieve data
whenever required.

2
BASIC BLOCK DIAGRAM AND FUNCTIONS OF
COMPUTER

 There are basic five components which are:


 Central processing unit (CPU) (ALU and CU)
ALU CU
 Memory
 Input device Input Output
 Output device
Primary Memory
 Secondary storage device

Secondary Memory 3
CENTRAL PROCESSING UNIT (CPU)
 Central Processing Unit (CPU) is main part of computer system that contain electronic
circuitry that actually process the data.
 Acting on the instruction it receives, the CPU performs operation on data.
 It also controls the flow of data through the system, directing the data to enter the system
placing data in memory and retrieving them when needed, and directing the output.
 CPU = ALU (Arithmetic logic unit) + CU (Control Unit)
 ALU: Here actual execution instruction take place during processing operation.
 It performs all arithmetic calculations and take logical decision.
 It can compare, count, shift or other logical activities.
 All such calculation and comparisons are done in this unit.
 It takes data from memory unit and return information (process data) to memory unit if
4
storage require.
CENTRAL PROCESSING UNIT (CPU)

 CU: It manages and coordinates operations of all other components of computer system.
 It also perform following functions:
 It retrieve instruction or data from memory.
 It decode instruction.
 It determine requirement of storage and take action according to it.
 It also fetch instruction from main memory.

5
MEMORY UNIT
 The storage unit of computer system store data for following purposes.
 Processing data and instructions
 Storage of temporary result (intermediate data storage)
 Permanent storage for future requirement (secondary storage)
 There are two types of storage:
 Primary storage
 Secondary or auxiliary storage

 Primary storage:
 Store current program or data (running program)
 Store temporary data of current program
 Less space in comparison of secondary storage
 Volatile (data losses on power off)
6
 Comparatively more expensive
 Fast in operation
MEMORY UNIT

 Secondary storage:
 Used to store data and program for future usage.
 Large capacity (GB/TB) in comparison with primary memory
 Slower than primary memory
 Retain data without power
 Cheaper than primary memory

7
INPUT/OUTPUT
 Basic aim of IO devices is to provide communication between computer and user.
 Input device transmit the data as a series of electrical pulses into the computer memory
unit where it will be available for processing.
 Input devices: keyboard, mouse, mic, webcam
 Output devices supply result of processing from primary storage or secondary storage.
 When a program executed and the results must be made available in a human readable
form.
 The output device translate processed data from a machine coded form to a form that can
be read and used by people.
 Output devices: monitor, printer, speaker

8
SOFTWARE
 Computer software refers to collection of programs.
 Program is the collection of instructions, which performs particular task and collection of
programs which accomplishes application is called software.
 There are basically two types of software available:
 System software
 Application software
 General purpose
 Specific purpose software

9
SYSTEM SOFTWARE
 Computer software refers to collection of programs.
 System software is designed to control operation and extend the processing capabilities of
computer system.
 They control internal computer functions, such as:
 Reading data from input device
 Transmit processing information to output devices
 Provide various facilities likes file management
 Input/Output management
 CPU time to user program during execution of program

 The help hardware component work together and provide support for development and
execution of application software.
 Example: Operating System (OS), Compiler, Assembler, Loader, Linker, Translator, Macro 10

processor, Interpreters
APPLICATION SOFTWARE
 A software designed for user specific need is called application software or application
package.
 Example: Library management, school management, hospital management
 They are developed with help of programming language or packages.
 Some program direct the computer to perform specific tasks requested by user, such as
printing report of customize program, mail, store result etc., such program also called
application software.
 There are two types of application software
 General Purpose Software: General purpose :They are designed for many task and provide
many number of tasks and provides many features. For Ex: Microsoft Office
 Specific Purpose Software: The packages pay roll, financial accounting, inventory control
are some of the specific purpose software.
11
 The pay roll packages developed for an organization following a set of rules and may not
apply to another organization as the pay calculation rules varies.
COMPILER VS. INTERPRETER

Compiler Interpreter
 Compiler scan the whole program at a time and  Interpreter scans the program line by line and
lists out errors if any. stop scanning whenever error occurs.
 Compiler converts the whole source code into  Interpreter converts the source program line
object code at a time. by line.
 After compilation, source code is not required.
 For every execution run source is required.
 Execution is faster.
 Execution is slower
 The object code is generated when the program
 No object code file is generated.
is error free.
 Compiler converts high level language into low  Interpreter converts high level language to
level language (Whole code is converted). low level language, line by line.

12
PROGRAMMING LANGUAGES
 Language is system for communicating.
 Written languages use symbols (characters) to build words.
 The entire set of words is language's vocabulary.
 The way in which words can be meaningfully combined are defined by the language's
syntax and grammar.
 The actual meaning of words and combinations of words is defined by the language's
semantics.
 Programming language is a vocabulary and set of grammatical rules for instructing
computer to perform specific tasks.
 It is classified as:
 Machine language or Low level language
 Assembly Language 13

 High Level Language


MACHINE OR LOW LEVEL LANGUAGE
 In this language programs are written in 0's and I's forms (binary language), which are
directly understandable to computer system.
 Every CPU has its own machine language.
 Example:
 101111011111101111
 It has following features:
 Program execution is faster in comparison with others
 Due to direct writing in to machine code the size of code is compact and small in comparison with
other languages
 It occupies less memory

 Drawback/Disadvantage
14
 It require depth technical knowledge to debug program.
 Due to only two combination (0's and 1's) it is difficult to understand.
ASSEMBLY LANGUAGE
 It is also classified as low - level language.
 This language uses mnemonics in place of O's and I's to represent codes.
 Example:
 LDA A
 ADD B
 STR C
 Symbolic presentation makes easy to write program
 Limitations
 Coding in this language is time-consuming
 This language is machine-oriented i.e. they are designed for specific make and model of processor 15
being used.
HIGH LEVEL LANGUAGE
 These are the languages whose instructions closely resemble human language and
mathematical notation.
 Unlike assembly language, programs made in this language may be used with different makes
of computers with little modification.
 Advantages
 Easier to learn
 Requires less time to write
 Provides better documentation
 Easier to maintain

 As a result, high level languages are used more often than machine or assembly languages.
 High level languages must also be translated in to machine language before they can be used
by a computer. 16
 One of the two different language-translator program is used to translate high-level language:
compiler and interpreter.
ALGORITHM
 An algorithm is a finite sequence of well defined steps or operations for solving a problem
in systematic manner.
 These are rules for solving any problems in proper manner.
 Instruction are written in the natural language.
 It is also called step by step solution.
 Properties/Characteristic:
 Finiteness
 Definiteness
 Effectiveness
 Input/Output

17
WRITE AN ALGORITHM TO FIND OUT SUM OF TWO
NUMBERS

 Step 1: input two numbers : a,b


 Step 2: calculate sum = a+b
 Step 3: print "total = “, sum
 Step 4: stop

18
WRITE A ALGORITHM TO FIND OUT ARE OF
SQUARE

 Step 1: input length : len


 Step 2: calculate area=len*len
 Step 3: print " area = “, area
 Step 4 : stop

19
WRITE AN ALGORITHM TO FIND AVERAGE OF THREE
NUMBERS

 Step 1: input three numbers a,b,c


 Step 2: calculate sum = a+b+c
 Step 3: avg = sum /3
 Step 4: print "average ", avg
 Step 5: stop

20
WRITE AN ALGORITHM TO FIND WHETHER GIVEN NUMBER IS
POSITIVE OR NEGATIVE.

 Step 1: input number: num


 Step 2: check if num < 0 then go to step 5
 Step 3: print "positive "
 Step 4: stop
 Step 5: print "negative "
 Step 6: stop

21
WRITE AN ALGORITHM TO FIND OUT MINIMUM NUMBER
FROM THREE INPUT NUMBERS

 Step 1: input number: a, b, c


 Step 2: check if a>b then goto next step otherwise goto step 8
 Step 3: check if a>c then goto next step otherwise goto step 6
 Step 4: Display “Max = ”, a
 Step 5: Stop
 Step 6: Display “Max = ”, c
 Step 7: Stop
 Step 8: check if b>c then goto next step otherwise goto step 6
 Step 9: Display “Max = ”, b
22
 Step 10: Stop
 Step 11: Display “Max = ”, c
FLOWCHART
 Computer software refers to collection of programs.
 Flowchart is graphical or diagrammatic representation of sequence of any problem to be
solved by a computer programming language.
 It is used before writing any program.
 It is also used to correct and debug a program flow after coding part is completed.
 Through flowchart it is easy to understand the logic and sequence of problem steps.
 After drawing flowchart it becomes easy to write any program.
 There are various standard symbols available to represent logic of problem which are...

Start/Stop 23
FLOWCHART

Input/Output

Process or Expression

Condition
Decision 24
FLOWCHART

Flow Lines

Connector

Loop 25
DRAW A FLOWCHART TO FIND OUT SUM OF TWO NUMBERS

Start

Input: a,b

sum = a+b

Print “Sum
=”, sum

26

Stop
DRAW A FLOWCHART TO FIND OUT SUM OF TWO NUMBERS

27
DRAW A FLOW CHART TO FIND AREA OF RECTANGLE

Start

Input:
length,
width

Area
=Length*width

Print “Area
=”,Area

Stop
28
DRAW A FLOW CHART TO FIND AREA OF RECTANGLE

29
DRAW A FLOWCHART TO FIND AVERAGE OF 3 SUBJECTS
MARKS

Start Start

Input: Input:
a,b,c a,b,c

Avg = sum = a+b+c


(a+b+c)/3

Print “Ävg
of 3 sub
=”,Avg
Avg = sum/3

Stop Print “Ävg


=”,Avg

30

Stop
DRAW A FLOWCHART TO FIND AVERAGE OF 3 SUBJECTS
MARKS

31
DRAW A FLOWCHART TO FIND MAXIMUM NUMBER FROM
TWO NUMBERS
Start

Input:
a,b

True a>
False
b

Print Print
“Max=”,a “Max=”,b

32

Stop
DRAW A FLOWCHART TO FIND MAXIMUM NUMBER FROM
TWO NUMBERS

33
DRAW A FLOW CHART TO FIND WHETHER GIVEN NUMBER IS
ODD OR EVEN
Start

Input:
n
n
True % False
2
==
0

Print Print
“Given no “Given no
is even” is odd

34
Stop
DRAW A FLOW CHART TO FIND WHETHER GIVEN NUMBER IS
ODD OR EVEN

35
DRAW A FLOW CHART TO FIND MAXIMUM NUMBER FROM
THREE DIFFERENT NUMBERS
Start

Input:
a,b,c

True a> False


b

True a> False False True


b>
c c

Display Display Display 36


“A is “C is “B is
Max” Max” Max”
A B C

Stop

37
DRAW A FLOW CHART TO FIND MAXIMUM NUMBER FROM
THREE DIFFERENT NUMBERS

38
DRAW A FLOW CHART TO FIND ROOT OF EQUATION:
AX2+BX+C
Start

Input:
a,b,c

2
𝑑=𝑏 − 4 𝑎𝑐

False d< True


0

A B 39
DRAW A FLOW CHART TO

A B

X1=
Display
“Roots
are -ve”

X2=

Display
X1, X2
40
DRAW A FLOW CHART TO FIND WHETHER GIVEN NO. IS +VE OR -VE

Start

Input:
n

True n False
<
0

Print “No Print “No


is -ve” is +ve”

41

Stop
DRAW A FLOW CHART TO FIND FACTORIAL OF GIVEN NO.

42

You might also like