Você está na página 1de 17

Kaushlendra Pratap Singh Flowchart Basics

FUNDAMENTALS
OF
PROGRAMMING
(USING FLOWCHARTS)

Kaushlendra Pratp Singh


Kaushlendra Pratap Singh Flowchart Basics

Index

Chapter 1 -Basics of Computers ................................................................... 3

• Computers are classified in categories / shapes :................................. 5

• Parts of Information System : ........................................................... 5

• Operations in ALU: .......................................................................... 8

Chapter 2 - Data Representation & Data Communication ........................... 10

• Introduction : ............................................................................... 10

• Data Communication & Networking :............................................... 11

• Features of Networking .................................................................. 11

• Types of Networks ......................................................................... 11

Chapter 3 - Flowcharts – Elementary Concepts .......................................... 14

• Introduction .................................................................................. 14

• Types of Flowcharts ....................................................................... 14

• Symbols used in Flowcharts ............................................................ 15

• Advantages of using flowcharts ....................................................... 16

• Limitations of using flowcharts ........................................................ 16

• Constants and Variable................................................................... 16


Kaushlendra Pratap Singh Flowchart Basics

Chapter 1 -Basics of Computers

Introduction :
It is a truly amazing machine. It is an electronic device used to process data. In
1940’s & 1950’s computers were of massive size used by big institutions, govt.
offices, military & universities.

Computer is derived from the word “Compute” which means to calculate. As they can
store, process & retrieve data ,as and when required they are also known as Data
Processor. eg. : ENIAC , UNIVAC etc.

Historical development of Computer :

Around 3000 BC in China a computer called Abacus was developed which used
beads to represent decimal & arithmetic operations of smaller volume can be
performed with its help. Number of improvements were made till the “Stepped-
Wheel” calculator was invented which multiplied & divided directly.

In 1822, “Charles Babbage” of England proposed the “Differential Engine”


which was refined to “Analytical Engine” in 1833, which became the first
completely automatic general purpose digital computer.

Punched card (Mark I) was invented in 1943 in Harvard University. The


original computer weighed about five tons. In operation, it was fed instructions that
were coded in the form of holes punched in a narrow paper tape or a punched paper
card.

ENIAC : Electronic Numerical Integrator & Calculator was designed in the year
1945 which contained 18000 vaccum-tubes, weighed 30 tons which occupied 1500
sq.ft. space & just 200 characters memory by J. Presper Eckert & John W. Mauchly at
Pennsylvania in Philadelphia.

EDVAC : Electronic Discrete Variable Automatic Computer was developed in


the year 1951 by J. Presper Eckert, John W. Mauchly & Jon Von Neuman for storing
data which used the Binary Number System.

UNIVAC : Universal Automatic Computer was developed by Remington Rand in


the year 1951.

Generations of Computers :

1> First Generation ( 1942 – 1955 ) :-

a) Physically large in size.


b) Rigid in operations.
c) Limited memory & computing capacity.
d) Slow operating speed i.e. ( in milli – seconds )
Kaushlendra Pratap Singh Flowchart Basics

e) Contained Vaccum Tubes.


f) Restricted programming capabilities.
g) Generated more heat.
h) Very high maintenance problems.
i) Very expensive.

2> Second Generation ( 1955 – 1964 ) :-

a) Considerable reduction in physical size.


b) Comparatively more reliable.
c) Comparably large memory.
d) Greater operating speed i.e. ( in micro – seconds )
e) Contained transistors as basic component & consumed less power.
f) Improved computing capacity.
g) Generated less heat as compared to first generation..
h) Faster & better input – output devices.

3> Third Generation ( 1964 – 1975 ) :-

a) Greater miniaturization.
b) Flexible in operation.
c) Larger memory.
d) High operating speed i.e. ( in nano – seconds )
e) Contained Integrated Circuits.
f) Very reliable & Random Access possible.
g) Time sharing & Multi Processing.
h) Compatible with other softwares.
i) High level languages like FORTRAN & COBOL came into existence.

4> Fourth Generation ( 1975 onwards ) :-

The advancement in the electronics could pack thousands of components into


very small assemblies known as LSI ( Large Scale Integration ) & it led to
the fourth generation of computers. Micro – processor was developed where
an entire CPU was accommodated on a single chip. Intel 4004 was the first
microprocessor which was further updated to Intel 8080 & this led to usage of
Personal Computers.

5> Fifth Generation ( Future computers ) :-

Here computer systems have been thought of using Artificial Intelligence &
Parallel Processing Hardware. Knowledge based expert systems would be
the main feature.
Kaushlendra Pratap Singh Flowchart Basics

Types of Computers :
1) Analog Computers :- These computers perform the complex processing by
directly measuring the continuous physical quantities.
eg :- Slide Rule, a hand operated computer was developed in 1620-1630 for
basic arithmetic calculations.
Differential Analyzer used in gun directors & bomb sights is also an analog
computer developed in 1876.
Antikythera Mechanism was developed in the year 1901 in Greece for all
Mathematical Operations.

2) Digital Computers :- They represent the numerical quantities by discrete


electrical states ON & OFF i.e. 1 & 0. They can be referred to as Electronic
Data Processing Machines.

3) Hybrid Computers :- Computers with the features of Analog & Digital


computers are known as Hybrid Computers. They have the measuring
capabilities of the analog computer & the logical, arithmetic & control
capabilities of the digital computer.
eg :- HRS – 100 (Hybridni Racunarski Sistem) developed in 1971 by Mihaljo
Pupin Institute Belgrade – Serbia. It was used by Academic of Sciences in
USSR.

Computers are classified in categories / shapes :

1) Micro Computers (PC) 2) Mini Computers


3) Mainframe Computers 4) Super Computers
Micro Computer

Desktop
Portable

Laptop / Notebook Palmtop / Handheld / PDA

Parts of Information System :

1) Hardware also simply known as computer. Any physical existence which can
be seen & touched.

2) Software set of instructions or programs which tells the computer how to


process the data.

3) Data raw material or facts about anything which is used as input to get useful
information / result.
Kaushlendra Pratap Singh Flowchart Basics

4) People the end-users who play a crucial role. Without people the computer is
of no use.

Hardware

Processor Memory Input / Output Storage

The procedure that transforms raw data into useful information is called
processing. Processor is like the brain of the computer. The board to which the
processor is connected is called as Motherboard or Mainboard. The term
Central Processing Unit ( CPU ) refers to the computers processing hardware.

Control Unit

Input Output
Devices Devices

Memory ALU

Control Unit controls the flow of instructions & data within the components.

Arithmetic Logic Unit (ALU ) is responsible for performing all the


computations like Arithmetic, Logical or Relational.

Memory is computers electronic scratchpad. Programs are loaded into and run
from memory. The most common type of memory is RAM ( Random Access
Memory ). The smallest measurement unit of data is 1 bit & that of memory
is 1 byte.

1 byte : 8 bits

1 kilo byte : 1024 bytes

1 mega byte : 1024 kilo bytes

1 giga byte : 1024 mega bytes

1 tera byte : 1024 giga bytes


Kaushlendra Pratap Singh Flowchart Basics

1. ROM ( Read Only Memory ) is non – volatile in nature. The permanent


programs like compilers, character shapes etc. are stores in the ROM. So
programs once written cannot be erased.

2. PROM ( Programmable Read Only Memory ) is also non – volatile in


nature, but the contents of PROM are decided by the user. Programs once written
cannot be erased or changed.

3. EPROM ( Erasable Programmable Read Only Memory ) is volatile nature.


Data can be erased or changed by exposing it to Ultraviolet rays of very high
intensity, so that it may be ready to accept new contents.

4. RAM ( Random Access Memory ) is volatile in nature. Information can be


read from & written to RAM at any instance , but it loses the data when there is
no electric supply.

Input & output devices are those devices which are used to accept data &
instruction from the user & return the processed data back to the user.

eg :-

Input Devices Output Devices

Keyboard, Mouse, Scanner, Joysticks, Monitor, Printer, Speaker.


Trackballs, Digital Camera, Microphones,
Bar code readers, Electronic Pen,

Touch screen & Modem has the functionality of both Input & Output.

Storage device is to hold data. They come in two types :

1) Primary / Volatile / Temporary : RAM

2) Secondary / Non – Volatile / Permanent : Harddisk, Floppy, CD, DVD,


Tape Drives, Removable
Harddisks.

Software brings machine to life. It is a set of instructions which tells the


computer how to process the data. Software are of two types.

Software

System Software Application Software

• Tells the computer how to Tells the computer how to


use its components. It is accomplish specific tasks for
an interface between the user the user.
& the PC. Eg. MS-Office etc.
Eg : Operating System.
Kaushlendra Pratap Singh Flowchart Basics

System Software

Operating System

Single User Multi User

Every machine having its own One operating system


operating system operated by shared by many users on
single user. different clients.

Difference between DOS & WINDOWS

DOS

• It is a command line operating system.


• Single tasking operating sytem.

WINDOWS

• It is a Graphical User Interface (GUI).


• Multi-tasking operating system.

Operations in ALU:

• Arithmetic Operators ( + , - , / , * , ** )
• Relational Operators ( < , > , <= , >= , = , <>)
• Logical Operators (AND , OR , NOT)

(NOT) (AND)
A B A AND B
A NOT A
FALSE FALSE FALSE
FALSE TRUE
FALSE TRUE FALSE
TRUE FALSE
TRUE FALSE FALSE
TRUE TRUE TRUE
Kaushlendra Pratap Singh Flowchart Basics

(OR) (XOR)
A B A XOR B
A B A OR B
FALSE FALSE FALSE
FALSE FALSE FALSE
FALSE TRUE TRUE
FALSE TRUE TRUE
TRUE FALSE TRUE
TRUE FALSE TRUE
TRUE TRUE FALSE
TRUE TRUE TRUE
(NAND) (NOR)

A B A NAND B A B A NOR B
FALSE FALSE TRUE FALSE FALSE TRUE
FALSE TRUE TRUE FALSE TRUE FALSE
TRUE FALSE TRUE TRUE FALSE FALSE
TRUE TRUE FALSE TRUE TRUE FALSE
Kaushlendra Pratap Singh Flowchart Basics

Chapter 2 - Data Representation & Data Communication

Introduction :

Computer recognizes only two distinct physical states produced by electricity,


magnetic polarity or reflected lights. All they can understand is the on & off
i.e. ( 1 & 0 ) state which are reflected by switches called as transistors.

1) Binary Numbering System uses the base as “2” . Base is also termed as
“RADIX”.

2) Decimal Numbering System uses the base as “10”.

Binary to Decimal Conversion

101 = 1x22 + 0x21 + 1x20 101.011 = 1x22 + 0x21 + 1x20 + 0x2-1 +


1x2-2 + 1x2-3
= 4+0+1 = 4 + 0 + 1 + 0 + 0.25 + 0.125
= 5 = 5.375
( 101 )2 = ( 5 )10 ( 101 .011 )2 = ( 5.375 )10

Decimal to Binary Conversion

2 13
2 6 1
2 3 0
2 1 1
1 1

0.125 x 2 = 0.250
0.250 x 2 = 0.500
0.500 x 2 = 1.000 ( 13.125 )10 = ( 1101.001 )2

Ones Complement

It can be obtained by flipping each digit. i.e. 1 to 0 & 0 to 1


e.g. 11010 = 00101

Twos Complement

It can be obtained by adding 1 to its ones complement.


e.g.
Number : 11010
Kaushlendra Pratap Singh Flowchart Basics

Ones Compliment : 00101


+ 1
--------
Twos Compliment 00110
--------

Data Communication & Networking :

Electronic transfer of information between computers is called as Data


Communication.

Computers communicate in two ways :

1) Through Modems
2) Through Networks

Network is a way to connect computers together so that they can communicate,


exchange information & share resources.

Analog Communication

Analog computers perform the complex processing by directly measuring the


continuous physical systems.
e.g. Telephone, Slide Rule used to measure length.

Digital Communication

Digital computers represent the numerical quantities by the discrete electric states
( ON | OFF ) which can be manipulated logically & arithmetically.

Features of Networking

1) Allows simultaneous access to critical programs & data.


2) Allows people to share peripheral devices.
3) Streamlining personal communication with email.
4) Making the backup process easy.

Types of Networks

1) Local Area Network – ( LAN ) :-

A network of computers located relatively near each other & connected by cable is
known Local Area Network. It permits all the computers connected to it to share
hardware, software & data as if to be directly connected to the users computer. E.g
Computers connected to each other within any organization or institute,
Kaushlendra Pratap Singh Flowchart Basics

Server

2) Wide Area Network - (WAN):-

When two or more networks are connected together generally across a wide
geographical area using high-speed or dedicated telephone lines. WAN means
network of networks. E.g. Internet.

Server 1 Server 2
Gateway Gateway

Gateway is a computer that connects


to networks & translate the
information.

Protocols:-

A protocol is a set of rules which dictates the format of a conversation between


communicating stations.
e.g. TCP / IP , FTP , HTTP
Kaushlendra Pratap Singh Flowchart Basics

1) TCP / IP – Tranmission Control Protocol / Internet Protocol:-

On a network, data is sent in small groups called packets. A packet is a group of bits
that includes header, payload & control elements that are transmitted together.

To : B To : B To : B
From : A From : A From : A
Content : Text Content : Text Content : Text
A Packet # : 1 Packet # : 2 Packet # : 3 B

Hello How Are You ?

2) FTP – File Transfer Protocol:-

FTP is required at the time of actual storing of files to & from the server. It can be
also termed as uploading & downloading.

3) HTTP – HyperText Transfer Protocol:-

HTTP is required to transfer the dynamic data from one page to another. Dynamic
includes text, images, animations and dynamic text through forms like ( email
registration ).

Internet & Intranet:

Internet means interconnection of networks. It is the product of a military


undertaking. The Pentagon’s Advance Research Project Agency ( ARPA )
funded its creation in 1969 as ARPANET.

A LAN network or a software developed for internal messaging between employees


within an organization is called Intranet.

World Wide Web ( WWW )

Designed by Tim Berners – Lee. WWW exploits two technologies like Multimedia &
Hypertext, together which is known as Hypermedia. Multimedia refers to combination
of text, colour, graphics, sound, video in presentation of data. Hypertext means
presentation of text in different format with embedded links or extra effects. The
language used to create hypertext is called Hypertext Markup Language
( HTML ).

Uses of Internet

1) Email & Chatting


2) Online Shopping
3) Online Reservation
4) E-Learning
5) Online Exams
6) Online Banking etc.
Kaushlendra Pratap Singh Flowchart Basics

Chapter 3 - Flowcharts – Elementary Concepts

Introduction

Before solving a problem with the help of a computer, it is essential to plan the
solution in a step by step manner. Such a planning is represented symbolically with
the help of so called flowchart. Flowcharts are a modeling technique introduced in
1940/50s and popularized for structured development as well as business modeling
in 1970s (Gane and Sarson 1979).

It is an important tool of systems analysts and programmers for tracing the


information flow and logical sequence in data processing. Logic is essence of a
flowchart.

Flowcharts can be drawn for simple as well as complex operations and are possible
even in a non-computerized environment. Trial and error should be avoided as the
computer time is precious. The logic should be depicted in the flowchart.
Computerization of data without a flowchart is like constructing a building without a
proper design and detailed drawings.

Types of Flowcharts

• Linear flow chart (or chain)

Linear flow charts arrange items in one line,


forming a "chain." Arrows indicate the order in
which to read the text.

• Forked flow chart

Forked flow charts include at least one fork


that splits one sequence into two or more
sequences. In this example the fork shows
that more than one event is caused by the
rain.
Kaushlendra Pratap Singh Flowchart Basics

• Cyclical flow chart (or loop)

Cyclical flow charts (or loops) have all items arranged in an


endless loop, showing that the sequence may be repeated.
Any of its events can be seen as a starting point.

Symbols used in Flowcharts

A typical flowchart from older Computer Science textbooks may have the following
kinds of symbols:

• Start and end symbols, represented as ovals or rounded rectangles, usually


containing the word "Start" or "Stop", or another phrase signaling the start or
end of a process, such as "submit enquiry" or "receive product".

• Arrows, showing what's called "flow of control" in computer science. An arrow


coming from one symbol and ending at another symbol represents that
control passes to the symbol the arrow points to.

• Processing steps, represented as rectangles. Examples: "Add 1 to X"; "replace


identified part"; "save changes" or similar.

• Input/Output, represented as a parallelogram. Examples: Get X from the


user; display X.

• Conditional (or decision), represented as a diamond (rhombus). These


typically contain a Yes/No question or True/False test. This symbol is unique
in that it has two arrows coming out of it, usually from the bottom point and
right point, one corresponding to Yes or True, and one corresponding to No or
False. The arrows should always be labeled. More than two arrows can be
used, but this is normally a clear indicator that a complex decision is being
taken.

• For a complex calculation or decision, a "pre-defined process" symbol can be


used which is represented with two vertical lines inside the two sides of the
rectangle.

• Connector or joining of two parts of program, represented as a circle


Kaushlendra Pratap Singh Flowchart Basics

• Annotation basically to print the comments, represented as left square


bracket proceeding with doted line.

• Output can be in two ways a soft copy or hardcopy. For soft copy symbol is a
bullet shaped know as Visual Display & for hard copy it is a rectangle with
wavy line know as Document Print Out.

Advantages of using flowcharts

The benefits of flowcharts are as follows:

1. Communication: Flowcharts are better way of communicating the logic of a


system to all concerned.

2. Effective analysis: With the help of flowchart, problem can be analysed in


more effective way.

3. Proper documentation: Program flowcharts serve as a good program


documentation, which is needed for various purposes.
4. Efficient Coding: The flowcharts act as a guide or blueprint during the
systems analysis and program development phase.

5. Proper Debugging: The flowchart helps in debugging process.

6. Efficient Program Maintenance: The maintenance of operating program


becomes easy with the help of flowchart. It helps the programmer to put
efforts more efficiently on that part

Limitations of using flowcharts

1. Complex logic: Sometimes, the program logic is quite complicated. In that


case, flowchart becomes complex and clumsy.

2. Alterations and Modifications: If alterations are required the flowchart


may require re-drawing completely.

3. Reproduction: As the flowchart symbols cannot be typed, reproduction of


flowchart becomes a problem.

4. The essentials of what is done can easily be lost in the technical details of
how it is done.

Constants and Variable

Constants have values that do not change during the execution of the program. It
can be declared using the term CONST.

(e.g.) Const pi = 3.143


Kaushlendra Pratap Singh Flowchart Basics

A variable is any entity that can take on different values. Anything that can vary can
be considered a variable.

( e.g.) age can be considered a variable because age can take different values for
different people or for the same person at different times.

In an attempt to solve problems on a computer, one has to express the steps for the
solution in terms of simple conceptual instructions and operations and then obtain
the results.

There may be number of ways to solve a given problem and the solution-methods
may vary from person to person, depending on one’s logic. But the basic steps would
constitute:

i) Formulating the problem and deciding the input data, if any.


ii) Identifying the various steps of computation that are must for the
solution.
iii) Identifying the points of decision i.e. under what circumstances a
particular operation is to be performed and when it is not to be
performed.
iv) Knowing the expected results and when to obtain the output.

Besides these, a person has to decide the various type of variables that should be
used to solve the problem.

Assignments

Draw flowcharts to get following outputs.

1) Sum of first N positive integers.


2) Find the least no out of 4 nos. given by user.
3)

Você também pode gostar