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

Chapter 1 Introduction To Computer And Programming

C Programming

Uploaded by

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

Chapter 1 Introduction To Computer And Programming

C Programming

Uploaded by

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

CHAPTER -1

INTRODUCTION TO COMPUTER AND


PROGRAMMING

Prepared By:
Subject : PPS
Asst. Prof. Rupali Patel
Code : 3110003 (CSE Department, ACET)
Block Diagram of Computer
Mainly computer system consists of three parts, that are central
processing unit (CPU), Input Devices, and Output Devices. The Central
Processing Unit (CPU) is divided into two parts again: arithmetic logic
unit (ALU) and the control unit (CU).

The data is entered through input devices such as the keyboard, mouse,
etc. This set of instruction is processed by the CPU after getting the input
by the user, and then the computer system produces the output. The
computer can show the output with the help of output devices to the user,
such as monitor, printer, etc.
Block Diagram of Computer
Central Processing Unit (CPU)
The computer system is nothing without the Central processing Unit so, it is also
known as the brain or heat of computer. The CPU is an electronic hardware
device which can perform different types of operations such as arithmetic and
logical operation.

Control Unit
The control unit (CU) controls all the activities or operations which are
performed inside the computer system. It receives instructions or information
directly from the main memory of the computer.

Arithmetic and Logical Unit


The arithmetic and logical unit is the combinational digital electronic circuit that
can perform arithmetic operations on integer binary numbers.It presents the
arithmetic and logical operation.
Central Processing Unit (CPU)
Storage Unit
The information or set of
guidelines are stored in the storage
unit of the computer system. The
storage unit provides the space to
store the data or instruction of
processed data. The information or
data is saved or hold in computer
memory or storage device.
Components of Computer System
The hardware and software exist on the computer. The information which
is stored through the device is known as computer software. The hardware
components of the computer system are related to electronic and
mechanical parts, and the software component is related to data and
computer programs. Many elements are connected to the main circuit board
of the computer system called a “motherboard.”
 Processor.
 Main Memory.
 Secondary Memory.
 Input Devices.
 Output Devices.
These are mainly five components of the computer system. The computer
hardware, computer software, and liveware exist in the element of the
computer system.
Difference between Hardware & software
Software Hardware
It is a collection of programs to bring computer hardware system into It includes physical components of computer system.
operation.
It includes numbers, alphabets, alphanumeric symbols, identifiers, It consists of electronic components like ICs, diodes,
keywords, etc. registers, crystals, boards, insulators, etc.

Software products evolve by adding new features to existing Hardware design is based on architectural decisions to make
programs to support hardware. it work over a range of environmental conditions and time.
It will vary as per computer and its built-in functions and It is mostly constructed for all types of computer systems.
programming language.

It is designed and developed by experienced programmers in high- The hardware can understand only low-level language or
level language. machine language.
It is represented in any high-level language such as BASIC, COBOL, The hardware works only on binary codes 1’s and 0’s.
C, C++, JAVA, etc.
The software is categorized as operating system, utilities, language The hardware consists of input devices, output devices,
processor, application software, etc. memory, etc.
Difference between Compiler & Interpreter
Interpreter Compiler
Translates program one statement at a time Scans the entire program and translates it as a whole
into machine code.
It takes less amount of time to analyze the source code but It takes a large amount of time to analyze the source
the overall execution time is slower. code but the overall execution time is comparatively
faster.
No intermediate object code is generated, hence are Generates intermediate object code which further
memory efficient. requires linking, hence requires more memory..
Continues translating the program until the first error is met, It generates the error message only after scanning
in which case it stops. Hence debugging is easy. the whole program. Hence debugging is
comparatively hard.
Programming languages like Python, Ruby use interpreters. Programming languages like C, C++, Java use
compilers.
Languages
What is Machine Language?
A computer’s native language is called Machine Language. Machine language is
the most primitive or basic programming language that starts or takes
instructions in the form of raw binary code. Ex.:1101101010011010

What is Assembly Language?


Assembly Language uses short descriptive words (mnemonic) to represent each
of the Machine Language instructions. For example the mnemonic add means to
add numbers together, and sub means to subtract the numbers

What is a High-Level Language?


High-Level languages are platform independent, meaning that you can write &
run High-Level Languages on different types of machines. High-Level
Languages are English like and therefore easier to learn and use. Note that
instructions in a High-Level Language are called statements.
Algorithm
Algorithm refers to a set of rules/instructions that step-by-step define how a
work is to be executed upon in order to get the expected results.

In-order to write an algorithm, following things are needed as a pre-requisite:


1. The problem that is to be solved by this algorithm.
2. The constraints of the problem that must be considered while solving
the problem.
3. The input to be taken to solve the problem.
4. The output to be expected when the problem the is solved.
5. The solution to this problem, in the given constraints.

Then the algorithm is written with the help of above parameters such that it
solves the problem.
Algorithm
EXAMPLE : Write an algorithm to add two numbers entered by the user
Step 1: Start
Step 2: Declare variables num1, num2 and sum.
Step 3: Read values num1 and num2.
Step 4: Add num1 and num2 and assign the result to sum.
sum←num1+num2
Step 5: Display sum
Step 6: Stop
Flow Charts
A flowchart is a blueprint that pictorially represents the algorithm and its steps.
The steps of a flowchart do not have a specific size and shape rather it is
designed in different shapes and sizes .
Flow Charts
EXAMPLE : Add two numbers entered by the user.

You might also like