Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
38 views

Programming For Problem Solving - 1

The document discusses the objectives and topics of a programming course, including an introduction to computer systems, hardware, software, programming languages, and algorithms. It provides details on different types of computer hardware, software, programming languages from machine language to high-level languages, and the basic concept of algorithms.

Uploaded by

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

Programming For Problem Solving - 1

The document discusses the objectives and topics of a programming course, including an introduction to computer systems, hardware, software, programming languages, and algorithms. It provides details on different types of computer hardware, software, programming languages from machine language to high-level languages, and the basic concept of algorithms.

Uploaded by

Netaji Gandi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

PROGRAMMING FOR PROBLEM SOLVING

DIGITAL NOTES
Course Objectives

• To understand the various steps in Program development.

• To understand the basic concepts in C Programming Language.

• To learn how to write modular and readable C Programs

• To learn to write programs (using structured programming approach) in C to solve problems.

TEXT BOOKS:
1. Computer Programming with C, Special Edition‐MRCET, Mc Graw Hill Publishers 2017.

2. Computer Science: A Structured Programming Approach Using C, B.A.Forouzan and R.F. Gilberg,

Third Edition, Cengage Learning.

REFERENCE BOOKS:

1. The C Programming Language, B.W. Kernighan and Dennis M.Ritchie, PHI.

2. Computer Programming, E.Balagurusamy, First Edition, TMH.

3. C and Data structures – P. Padmanabham, Third Edition, B.S. Publications.

4. Programming in C, Ashok Kamthane. Pearson Education India.

5. Let us C ,Yashwanth Kanethkar, 13th Edition, BPB Publications.

Course Outcomes:

 Demonstrate the basic knowledge of computer hardware and software.


 To formulate simple algorithms for arithmetic and logical problems.
 To translate the algorithms to programs (in C language).
 To test and execute the programs and correct syntax and logical errors.
 Ability to apply solving and logical skills to programming in C language and also in other
languages.
UNIT - I
Introduction to Computing:
Computer Systems:
A computer is a system made of two major components: hardware and software. The computer
hardware is the physical equipment. The software is the collection of programs (instructions)
that allow the hardware to do its job.

Computer
System

Hardware Software

Computer Hardware
The hardware component of the computer system consists of five parts: input devices, central
processing unit (CPU) ,primary storage, output devices, and auxiliary storage devices.
The input device is usually a keyboard where programs and data are entered into the
computers. Examples of other input devices include a mouse, a pen or stylus, a touch screen, or
an audio input unit.

The central processing unit (CPU) is responsible for executing instructions such as arithmetic
calculations,comparisons among data, and movement of data inside the system. Today’s
computers may have one ,two, or more CPUs .Primary storage ,also known as main memory, is
a place where the programs and data are stored temporarily during processing. The data in
primary storage are erased when we turn off a personal computer or when we log off from a
time‐sharing system.

The output device is usually a monitor or a printer to show output. If the output is shown on
the monitor, we say we have a soft copy. If it is printed on the printer, we say we have a hard
copy.

Auxiliary storage, also known as secondary storage, is used for both input and output. It is the
place where the programs and data are stored permanently. When we turn off the computer,
or programs and data remain in the secondary storage, ready for the next time we need them.

Computer Software
Computer software is divided in to two broad categories: system software and application
software .System software manages the computer resources .It provides the interface between
the hardware and the users. Application software, on the other hand is directly responsible for
helping users solve their problems.

Software

System Application
software software

System System General Application


Operating support Developmen Purpose Specific
Systems

Fig: Types of software


System Software:

System software consists of programs that manage the hardware resources of a computer and
perform required information processing tasks. These programs are divided into three classes:
the operating system, system support, and system development.

The operating system provides services such as a user interface, file and database access, and
interfaces to communication systems such as Internet protocols. The primary purpose of this
software is to keep the system operating in an efficient manner while allowing the users access
to the system.

System support software provides system utilities and other operating services. Examples of
system utilities are sort programs and disk format programs. Operating services consists of
programs that provide performance statistics for the operational staff and security monitors to
protect the system and data.

The last system software category ,system development software, includes the language
translators that convert programs into machine language for execution ,debugging tools to
ensure that the programs are error free and computer –assisted software engineering(CASE)
systems.

Application software

Application software is broken in to two classes :general‐purpose software and application –


specific software. General purpose software is purchased from a software developer and can
be used for more than one application. Examples of general purpose software include word
processors ,database management systems ,and computer aided design systems. They are
labeled general purpose because they can solve a variety of user computing problems.

Application –specific software can be used only for its intended purpose.

A general ledger system used by accountants and a material requirements planning system
used by a manufacturing organization are examples of application‐specific software. They can
be used only for the task for which they were designed they cannot be used for other
generalized tasks.

The relation ship between system and application software is shown in fig-2.In this figure, each
circle represents an interface point .The inner core is hard ware. The user is represented by the
out layer. To work with the system,the typical user uses some form of application software. The
application software in turn interacts with the operating system ,which is apart of the system
software layer. The system software provides the direct interaction with the hard ware. The
opening at the bottom of the figure is the path followed by the user who interacts directly with
the operating system when necessary.
Computer Languages:
To write a program for a computer, we must use a computer language. Over the years
computer languages have evolved from machine languages to natural languages.

1940’s Machine level Languages

1950’s Symbolic Languages

1960’s High‐Level Languages

Machine Languages

In the earliest days of computers, the only programming languages available were machine
languages. Each computer has its own machine language, which is made of streams of 0’s and
1’s.

Instructions in machine language must be in streams of 0’s and 1’s because the internal circuits
of a computer are made of switches transistors and other electronic devices that can be in one
of two states: off or on. The off state is represented by 0 , the on state is represented by 1.

The only language understood by computer hardware is machine language.

Symbolic Languages:

In early 1950’s Admiral Grace Hopper, A mathematician and naval officer developed the
concept of a special computer program that would convert programs into machine language.
The early programming languages simply mirror to the machine languages using symbols of
mnemonics to represent the various machine language instructions because they used symbols,
these languages were known as symbolic languages.

Computer does not understand symbolic language it must be translated to the machine
language. A special program called assembler translates symbolic code into machine language.
Because symbolic languages had to be assembled into machine language they soon became
known as assembly languages.

Symbolic language uses symbols or mnemonics to represent the various ,machine language
instructions.

High Level Languages:

Symbolic languages greatly improved programming effificiency; they still required programmers
to concentrate on the hardware that they were using. Working with symbolic languages was
also very tedious because each machine instruction has to be individually coded. The desire to
improve programmer efficiency and to change the focus from the computer to the problem
being solved led to the development of high‐level language.

High level languages are portable to many different computers, allowing the programmer to
concentrate on the application problem at hand rather than the intricacies of the computer.
High‐level languages are designed to relieve the programmer from the details of the assembly
language. High level languages share one thing with symbolic languages, They must be
converted into machine language. The process of converting them is known as compilation.

The first widely used high‐level languages, FORTRAN (FORmula TRANslation)was created by
John Backus and an IBM team in 1957;it is still widely used today in scientific and engineering
applications. After FORTRAN was COBOL(Common Business‐Oriented Language). Admiral
Hopper was played a key role in the development of the COBOL Business language.

C is a high‐level language used for system software and new application code.

ALGORITHM:

Algorithms was developed by an Arab mathematician. It is chalked out step-by-step


approach to solve a given problem. It is represented in an English like language and has some
mathematical symbols like ->, >, <, = etc. To solve a given problem or to write a program you
approach towards solution of the problem in a systematic, disciplined, non-adhoc, step-by-step
way is called Algorithmic approach. Algorithm is a penned strategy(to write) to find a solution.
Example: Algorithm/pseudo code to add two numbers

Step 1: Start
Step 2:Read the two numbers in to a,b
Step 3: c=a+b
Step 4: write/print c
Step 5: Stop.

FLOW CHART :
A Flow chart is a Graphical representation of an Algorithm or a portion of an Algorithm.
Flow charts are drawn using certain special purpose symbols such as Rectangles, Diamonds,
Ovals and small circles. These symbols are connected by arrows called flow lines.

(or)

The diagrammatic representation of way to solve the given problem is called flow chart.

The following are the most common symbols used in Drawing flowcharts:

Oval Terminal start/stop/begin/end.

Parallelogram Input/output Making data available

For processing(input) or
recording of the process
information(output).

Rectangle Process Any processing to be

Done .A process changes or


moves data.An assignment
operation.
Diamond Decision Decision or switching

type of operations.

Circle Connector Used to connect

Different parts of flowchart.

Arrow Flow Joins two symbols

and also represents flow of


execution.

INTRODUCTION TO ‘C’ LANGUAGE:


C language facilitates a very efficient approach to the development and implementation
of computer programs. The History of C started in 1972 at the Bell Laboratories, USA where
Dennis M. Ritchie proposed this language. In 1983 the American National Standards Institute
(ANSI) established committee whose goal was to produce “an unambiguous and machine
independent definition of the language C “ while still retaining it’s spirit .

C is the programming language most frequently associated with UNIX. Since the 1970s, the bulk
of the UNIX operating system and its applications have been written in C. Because the C
language does not directly rely on any specific hardware architecture, UNIX was one of the first
portable operating systems. In other words, the majority of the code that makes up UNIX does
not know and does not care which computer it is actually running on. Machine‐specific features
are isolated in a few modules within the UNIX kernel, which makes it easy for you to modify
them when you are porting to a different hardware architecture.

You might also like