Computer Fundamental and Programming: Prepared By: Mary Kris P. Morco Professorial Lecturer

Download as pdf or txt
Download as pdf or txt
You are on page 1of 52

Computer

Fundamental and
Programming
Prepared by: Mary Kris P. Morco

Professorial Lecturer
COMPUTER FUNDAMENTAL & BICOL UNIVERSITY COLLEGE OF SCIENCE

PROGRAMMING

Today's Agenda
Number Systems

What is Number System in Maths?

Classification of Number System

Types of Number System

Number System Chart

Number System Conversion

Number System Examples


COMPUTER FUNDAMENTAL & BICOL UNIVERSITY COLLEGE OF SCIENCE

PROGRAMMING

What is
number
system?
A number system is a system

representing numbers. It is also

called the system of numeration

and it defines a set of values to

represent a quantity. These

numbers are used as digits and the

most common ones are 0 and 1,

that are used to represent binary

numbers. Digits from 0 to 9 are

used to represent other types of

number systems.
Definition of Number
Systems
A number system is defined as the representation of numbers by using digits or other symbols in a

consistent manner. The value of any digit in a number can be determined by a digit, its position in

the number, and the base of the number system. The numbers are represented in a unique manner

and allow us to operate arithmetic operations like addition, subtraction, and division.
COMPUTER FUNDAMENTAL & BICOL UNIVERSITY COLLEGE OF SCIENCE

PROGRAMMING

What is Number System in


Maths?
A number system is defined as a system of writing to express numbers. It
is the mathematical notation for representing numbers of a given set by
using digits or other symbols in a consistent manner. It provides a unique
representation of every number and represents the arithmetic and
algebraic structure of the figures. It also allows us to operate arithmetic
operations like addition, subtraction and division.

The value of any digit in a number can be determined by:

The digit

Its position in the number

The base of the number system


COMPUTER FUNDAMENTAL & BICOL UNIVERSITY COLLEGE OF SCIENCE

PROGRAMMING

Classification of Number
System
COMPUTER FUNDAMENTAL & BICOL UNIVERSITY COLLEGE OF SCIENCE

PROGRAMMING

Classification of Number
System
COMPUTER FUNDAMENTAL & BICOL UNIVERSITY COLLEGE OF SCIENCE

PROGRAMMING

Classification of Number
System
COMPUTER FUNDAMENTAL & BICOL UNIVERSITY COLLEGE OF SCIENCE

PROGRAMMING

Classification of Number
System
COMPUTER FUNDAMENTAL & BICOL UNIVERSITY COLLEGE OF SCIENCE

PROGRAMMING

What is a Number?
A number is a mathematical value used for counting or measuring or

labelling objects. Numbers are used to performing arithmetic

calculations. Examples of numbers are natural numbers, whole numbers,

rational and irrational numbers, etc. 0 is also a number that represents

a null value.

A number has many other variations such as even and odd numbers,

prime and composite numbers. Even and odd terms are used when a

number is divisible by 2 or not, whereas prime and composite

differentiate between the numbers that have only two factors and more

than two factors, respectively.

In a number system, these numbers are used as digits. 0 and 1 are the

most common digits in the number system, that are used to represent

binary numbers. On the other hand, 0 to 9 digits are also used for other

number systems.
COMPUTER FUNDAMENTAL & BICOL UNIVERSITY COLLEGE OF SCIENCE

PROGRAMMING

Types of Number Systems

Binary number system Octal number system Decimal number system Hexadecimal number
(Base - 2) (Base - 8) (Base - 10) system (Base - 16)
The octal number system uses
The binary number system uses The decimal number system uses The hexadecimal number system
eight digits: 0,1,2,3,4,5,6 and 7
only two digits: 0 and 1. The ten digits: 0,1,2,3,4,5,6,7,8 and 9 uses sixteen digits/alphabets:
with the base of 8. The advantage
numbers in this system have a with the base number as 10. The 0,1,2,3,4,5,6,7,8, 9 and A,B,C,D, E, F
of this system is that it has lesser
base of 2. Digits 0 and 1 are decimal number system is the with the base number as 16. Here,
digits when compared to several
called bits and 8 bits together system that we generally use to A-F of the hexadecimal system
other systems, hence, there would
make a byte. The data in represent numbers in real life. If means the numbers 10-15 of the
be fewer computational errors.
computers is stored in terms of any number is represented without decimal number system
Numbers like 8 and 9 are not
bits and bytes. The binary number a base, it means that its base is 10. respectively. This system is used in
included in the octal number
system does not deal with other computers to reduce the large-
system. Just as the binary, the
numbers such as 2,3,4,5 and so sized strings of the binary system.
octal number system is used in
on.
minicomputers but with digits from

0 to 7.
COMPUTER FUNDAMENTAL & BICOL UNIVERSITY COLLEGE OF SCIENCE

PROGRAMMING
What is a Binary Number System?
Binary Number System: According to digital electronics and mathematics, a binary number is

defined as a number that is expressed in the binary system or base 2 numeral system. It

describes numeric values by two separate symbols; 1 (one) and 0 (zero). The base-2 system is

the positional notation with 2 as a radix.

The binary system is applied internally by almost all latest computers and computer-based

devices because of its direct implementation in electronic circuits using logic gates. Every digit

is referred to as a bit.

What is Bit in Binary Number?


Binary A single binary digit is called a “Bit”. A binary number consists of several bits.

Examples are:

Number 10101 is a five-bit binary number

101 is a three-bit binary number

100001 is a six-bit binary number

System Uses of Binary Number System


Binary numbers are commonly used in computer applications. All the coding and languages in

computers such as C, C++, Java, etc. use binary digits 0 and 1 to write a program or encode any

digital data. The computer understands only the coded language. Therefore these 2-digit

number system is used to represent a set of data or information in discrete bits of information.

Facts to Remember:
Binary numbers are made up of only 0’s and 1’s.

A binary number is represented with a base-2

A bit is a single binary digit.


COMPUTER FUNDAMENTAL & BICOL UNIVERSITY COLLEGE OF SCIENCE

PROGRAMMING

Binary Number System


COMPUTER FUNDAMENTAL & BICOL UNIVERSITY COLLEGE OF SCIENCE

PROGRAMMING

Binary Numbers Table


Some of the binary notations of lists of decimal numbers from 1 to 30,

are mentioned in the below list.


COMPUTER FUNDAMENTAL & BICOL UNIVERSITY COLLEGE OF SCIENCE

PROGRAMMING

How to Calculate Binary Numbers


For example, the number to be operated is 1235.
COMPUTER FUNDAMENTAL & BICOL UNIVERSITY COLLEGE OF SCIENCE

PROGRAMMING

How to Calculate Binary Numbers


For example, the number to be operated is 1235.
COMPUTER FUNDAMENTAL & BICOL UNIVERSITY COLLEGE OF SCIENCE

PROGRAMMING

Binary Arithmetic Operations


COMPUTER FUNDAMENTAL & BICOL UNIVERSITY COLLEGE OF SCIENCE

PROGRAMMING

Binary Arithmetic Operations


COMPUTER FUNDAMENTAL & BICOL UNIVERSITY COLLEGE OF SCIENCE

PROGRAMMING

Binary Arithmetic Operations


COMPUTER FUNDAMENTAL & BICOL UNIVERSITY COLLEGE OF SCIENCE

PROGRAMMING

Binary Arithmetic Operations


COMPUTER FUNDAMENTAL & BICOL UNIVERSITY COLLEGE OF SCIENCE

PROGRAMMING
What is a Octal Number System?
Octal Number System has a base of eight and uses the number from 0 to 7. The octal numbers,

in the number system, are usually represented by binary numbers when they are grouped in

pairs of three.

Octal
Number
System
COMPUTER FUNDAMENTAL & BICOL UNIVERSITY COLLEGE OF SCIENCE

PROGRAMMING

Octal Numbers System


COMPUTER FUNDAMENTAL & BICOL UNIVERSITY COLLEGE OF SCIENCE

PROGRAMMING

Octal Numbers System Table


We use only 3 bits to represent Octal Numbers. Each group will have a distinct value

between 000 and 111.


COMPUTER FUNDAMENTAL & BICOL UNIVERSITY COLLEGE OF SCIENCE

PROGRAMMING
What is the Decimal Number System?
In the decimal number system, the numbers are represented with base 10. The way of denoting the

decimal numbers with base 10 is also termed as decimal notation. This number system is widely used in

computer applications. It is also called the base-10 number system which consists of 10 digits, such as,

0,1,2,3,4,5,6,7,8,9. Each digit in the decimal system has a position and every digit is ten times more

significant than the previous digit. Suppose, 25 is a decimal number, then 2 is ten times more than 5.

Some examples of decimal numbers are:

Decimal
Number
System
COMPUTER FUNDAMENTAL & BICOL UNIVERSITY COLLEGE OF SCIENCE

PROGRAMMING

Decimal Numbers System


COMPUTER FUNDAMENTAL & BICOL UNIVERSITY COLLEGE OF SCIENCE

PROGRAMMING
What is the Hexadecimal Number System?
The hexadecimal number system is a type of number system, that has a base value equal to 16. It is

also pronounced sometimes as ‘hex’ . Hexadecimal numbers are represented by only 16 symbols. These

symbols or values are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E and F. Each digit represents a decimal

value. For example, D is equal to base-10 13.

Hexadecimal number systems can be converted to other number systems such as binary number (base-

2), octal number (base-8) and decimal number systems (base-10).

Hexadeci
mal
Number
System
COMPUTER FUNDAMENTAL & BICOL UNIVERSITY COLLEGE OF SCIENCE

PROGRAMMING

Hexadecimal Number System Table


Below is the table of hexadecimal number systems with equivalent values of the binary and decimal number systems.
COMPUTER FUNDAMENTAL & BICOL UNIVERSITY COLLEGE OF SCIENCE

PROGRAMMING

Number System Conversion


Decimal to Other Base System

Other Base System to Decimal

Other Base System to Non-Decimal

Shortcut method - Binary to Octal

Shortcut method - Octal to Binary

Shortcut method - Binary to Hexadecimal

Shortcut method - Hexadecimal to Binary


COMPUTER FUNDAMENTAL & BICOL UNIVERSITY COLLEGE OF SCIENCE

PROGRAMMING

Decimal to Other Base System

Step 1 Step 2 Step 3 Step 4

Divide the decimal number Get the remainder from Divide the quotient of the Record the remainder from

to be converted by the Step 1 as the rightmost digit previous divide by the new Step 3 as the next digit (to

value of the new base. (least significant digit) of base. the left) of the new base

the new base number. number.

Repeat Steps 3 and 4,

getting remainders from

right to left, until the

quotient becomes zero in

Step 3.
COMPUTER FUNDAMENTAL & BICOL UNIVERSITY COLLEGE OF SCIENCE

PROGRAMMING
COMPUTER FUNDAMENTAL & BICOL UNIVERSITY COLLEGE OF SCIENCE

PROGRAMMING

Other Base System to Decimal


System

Step 1 Step 2 Step 3

Determine the column Multiply the obtained Sum the products

(positional) value of each column values (in Step 1) by calculated in Step 2. The

digit (this depends on the the digits in the total is the equivalent value

position of the digit and the corresponding columns. in decimal..

base of the number system).


COMPUTER FUNDAMENTAL & BICOL UNIVERSITY COLLEGE OF SCIENCE

PROGRAMMING
COMPUTER FUNDAMENTAL & BICOL UNIVERSITY COLLEGE OF SCIENCE

PROGRAMMING
COMPUTER FUNDAMENTAL & BICOL UNIVERSITY COLLEGE OF SCIENCE

PROGRAMMING
COMPUTER FUNDAMENTAL & BICOL UNIVERSITY COLLEGE OF SCIENCE

PROGRAMMING

Other Base System to Non-


Decimal System

Step 1 Step 2

Convert the original number Convert the decimal

to a decimal number (base number so obtained to the

10). new base number.


COMPUTER FUNDAMENTAL & BICOL UNIVERSITY COLLEGE OF SCIENCE

PROGRAMMING
COMPUTER FUNDAMENTAL & BICOL UNIVERSITY COLLEGE OF SCIENCE

PROGRAMMING
COMPUTER FUNDAMENTAL & BICOL UNIVERSITY COLLEGE OF SCIENCE

PROGRAMMING

Binary to Octal
and Vice Versa
COMPUTER FUNDAMENTAL & BICOL UNIVERSITY COLLEGE OF SCIENCE

PROGRAMMING
COMPUTER FUNDAMENTAL & BICOL UNIVERSITY COLLEGE OF SCIENCE

PROGRAMMING

Shortcut Method - Binary to Octal

Step 1 Step 2

Divide the binary digits into Convert each group of

groups of three (starting three binary digits to one

from the right). octal digit.


COMPUTER FUNDAMENTAL & BICOL UNIVERSITY COLLEGE OF SCIENCE

PROGRAMMING
COMPUTER FUNDAMENTAL & BICOL UNIVERSITY COLLEGE OF SCIENCE

PROGRAMMING

Shortcut Method - Octal to Binary

Step 1 Step 2

Convert each octal digit to Combine all the resulting

a 3-digit binary number (the binary groups (of 3 digits

octal digits may be treated each) into a single binary

as decimal for this number.

conversion).
COMPUTER FUNDAMENTAL & BICOL UNIVERSITY COLLEGE OF SCIENCE

PROGRAMMING
COMPUTER FUNDAMENTAL & BICOL UNIVERSITY COLLEGE OF SCIENCE

PROGRAMMING

Binary to
Hexadecimal and
Vice Versa
COMPUTER FUNDAMENTAL & BICOL UNIVERSITY COLLEGE OF SCIENCE

PROGRAMMING

Shortcut Method - Binary to


Hexadecimal

Step 1 Step 2

Divide the binary digits into Convert each group of four

groups of four (starting binary digits to one

from the right). hexadecimal symbol.


COMPUTER FUNDAMENTAL & BICOL UNIVERSITY COLLEGE OF SCIENCE

PROGRAMMING
COMPUTER FUNDAMENTAL & BICOL UNIVERSITY COLLEGE OF SCIENCE

PROGRAMMING

Shortcut Method - Hexadecimal to


Binary

Step 1 Step 2

Convert each hexadecimal Combine all the resulting

digit to a 4-digit binary binary groups (of 4 digits

number (the hexadecimal each) into a single binary

digits may be treated as number.

decimal for this conversion).


COMPUTER FUNDAMENTAL & BICOL UNIVERSITY COLLEGE OF SCIENCE

PROGRAMMING
COMPUTER FUNDAMENTAL & BICOL UNIVERSITY COLLEGE OF SCIENCE

PROGRAMMING

And we're done


for the day!

You might also like