0% found this document useful (0 votes)
112 views14 pages

NUMBER SYSTEM Notes 2024-25

NOTES OF NUMBER SYTEM

Uploaded by

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

NUMBER SYSTEM Notes 2024-25

NOTES OF NUMBER SYTEM

Uploaded by

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

NUMBER SYSTEM

We communicate using words and characters. We are familiar with numbers,


characters, and words. However, this type of data is incompatible with
computers. Computers can only comprehend numbers. As a result, when we
enter information, it is converted into an electronic pulse. ASCII converts the
code from each pulse into a numeric format. It assigns a numerical value
(number) to each number, character, and symbol. So, to understand computer
language, one must be familiar with number systems. Here we explore more
about the number system in computers, types of the number system in
computers, and conversion of the number system in computers.

What is a Number System?


We already know that computer systems cannot recognize or
understand the data or instructions given to them.

They first convert that data and instructions into binary form,
which is easily understood by computers.

All the letters, words, symbols, and special symbols are


converted into binary form, and this is done with a standard
code commonly known as ASCII {American Standard Code
for Information and Interchange}.

In other words, any number which is symbolically represented


in the system and the method is called a “number system”.

These numbers can efficiently perform mathematical


operations like addition, subtraction, multiplication, and
division.

Every number can be uniquely represented using this


technique.

The Number System is defined by the numbers or digits in the


number system.
The binary number consists of 2 digits, the Decimal consists of
10 digits, the Octal has 8,

The binary number consists of 2 digits, the Decimal consists of 10


digits, the Octal has 8, and finally, the hexadecimal number system
consists of 16 digits in their number system.

Importance of Number System in Our


Daily Life
The importance of the number system can be witnessed in day-
to-day life. The number system is essential for our existence.

They are for thousands of years now; their uses and


applications are endless. We can not imagine our life without
the use of Numbers.

Take out the number system from our society, and we will
return to the “Stone Age”.

The critical aspect of the number system is that it helps us to


understand and learn the world around us more
knowledgeably and intelligently for more productivity.

The number system is used and utilized in Mathematics as


without using numbers, math becomes useless. lets us
understand the whole system and world more comparably.

The number allows us to compare things like which is greater


or smaller.

In math, students should learn counting of a number using


fingers or objects. This helps students understand that each
number represents its value that cannot be changed or edited.

The Main Uses of Number System


The number system is one of the essential aspects of our daily
life. It helps us to count, compare and measure things around
us.

The number system also helps us express ourselves through


telephone numbers, house addresses, or even social security
numbers.

1. The number system is widely and extensively used in daily


life. It helps us compare things, count objects, and
measure.
2. The number systems are used in Telephone Numbers and
Our Addresses.
3. To compare and register the height and weight of
anything using numbers.
4. Comparing prices at Malls and Shopping Plazas.
5. It is used in calculations like Addition, Subtraction,
multiplication, and Division.
6. It helps in making our monthly budgets.
7. Paying Bills and Debts.

5 Examples of Numbers in Daily Life


Types of the Number System in Computer
There are mainly four types of the number system in computer
 Binary Number System: The binary number system is the most fundamental
number system used in computer science. It uses only two digits, 0 and 1, to
represent all numbers and data.
 Decimal Number System: The decimal number system is also used in
computer science, but it is not as fundamental as the binary system. It uses
ten digits, 0 through 9, to represent numbers.
 Octal Number System: The octal number system uses eight digits, 0 through
7, to represent numbers. It is commonly used in computer programming and
digital electronics.

 Hexadecimal Number System: The hexadecimal number system uses 16


digits, including 0 through 9 and A through F, to represent numbers. It is often
used in computer programming and digital electronics.

Each of these number systems has its advantages and disadvantages, and
each is used in different applications. For example, the binary number system
is used to represent and manipulate data in computer hardware, while the
decimal number system is used for everyday calculations. The octal and
hexadecimal systems are commonly used in computer programming and
digital electronics because they are more compact and easier to read than
binary.

Converting between number system in computer science is an important skill,


especially when working with binary, octal, and hexadecimal numbers. Here
are the basic steps to convert a number from one number system to another:

Understand the values of each digit in the current number system: Before you
can convert a number, you need to understand how the current number
system works. For example, in the binary system, each digit represents a
power of two, starting with 20 on the right side.

Convert the number to decimal: To convert a number from any base to


decimal, you need to multiply each digit by its corresponding power of the
base and add up the results.
For example, to convert the binary number 1011 to decimal, you would
calculate (1 x 23) + (0 x 22) + (1 x 21) + (1 x 20) = 8 + 0 + 2 + 1 = 11.

Check your answer: To verify your answer, you can convert the number back
to the original base and make sure it matches the original number.

Example: Convert the decimal number 158 to binary, octal, and hexadecimal.
Below is the conversion one by one:

 Binary Conversion:
To convert a decimal number to binary, we divide the decimal number by 2
repeatedly and write the remainder in reverse order.

158 / 2 = 79 remainder 0
79 / 2 = 39 remainder 1
39 / 2 = 19 remainder 1
19 / 2 = 9 remainder 1
9 / 2 = 4 remainder 1
4 / 2 = 2 remainder 0
2 / 2 = 1 remainder 0
1 / 2 = 0 remainder 1

Therefore, the binary equivalent of 158 is 10011110.

 Octal Conversion:
To convert a decimal number to an octal, we divide the decimal number by 8
repeatedly and write the remainder in reverse order.

158 / 8 = 19 remainder 6
19 / 8 = 2 remainder 3
2 / 8 = 0 remainder 2

Therefore, the octal equivalent of 158 is 236.

 Hexadecimal Conversion:
To convert a decimal number to hexadecimal, we divide the decimal number
by 16 repeatedly and write the remainder in reverse order. For remainders
greater than 9, we use letters A-F.

158 / 16 = 9 remainder 14 (E)


9 / 16 = 0 remainder 9
Therefore, the hexadecimal equivalent of 158 is 9E.

 Output

 Decimal: 158

 Binary: 10011110

 Octal: 236

Hexadecimal: 9E

Code Implementation

 C++

#include <iostream>
#include <stack>
using namespace std;
void decimalToBinary(int decimalNum) {
stack<int> binaryNum;
while(decimalNum > 0) {
binaryNum.push(decimalNum % 2);
decimalNum /= 2;
}
cout << "Binary equivalent: ";
while(!binaryNum.empty()) {
cout << binaryNum.top();
binaryNum.pop();
}
cout << endl;
}
void decimalToOctal(int decimalNum) {
stack<int> octalNum;
while(decimalNum > 0) {
octalNum.push(decimalNum % 8);
decimalNum /= 8;
}
cout << "Octal equivalent: ";
while(!octalNum.empty()) {
cout << octalNum.top();
octalNum.pop();
}
cout << endl;
}
void decimalToHexadecimal(int decimalNum) {
stack<char> hexNum;
while(decimalNum > 0) {
int remainder = decimalNum % 16;
if(remainder < 10) {
hexNum.push(remainder + '0');
}
else {
hexNum.push(remainder - 10 + 'A');
}
decimalNum /= 16;
}
cout << "Hexadecimal equivalent: ";
while(!hexNum.empty()) {
cout << hexNum.top();
hexNum.pop();
}
cout << endl;
}
int main() {
int decimalNum;
cout << "Enter a decimal number: ";
cin >> decimalNum;
decimalToBinary(decimalNum);
decimalToOctal(decimalNum);
decimalToHexadecimal(decimalNum);
return 0;
}

nput

158

Output
Enter a decimal number: Binary equivalent: 10011110

Octal equivalent: 236

Hexadecimal equivalent: 9E

Explanation:
The conversion of a number system in computer involves dividing the given
number by the base of the target number system and writing the remainder in
reverse order. For binary, the base is 2, for octal, it is 8, and for hexadecimal,
it is 16. In each step, we divide the quotient obtained in the previous step by
the base of the target number system and take the remainder. We continue
this process until the quotient becomes zero. Finally, we write the remainder
obtained in reverse order to get the equivalent number in the target number
system. The program first prompts the user to enter a decimal number. It then
calls three different functions for converting the decimal number to binary,
octal, and hexadecimal. The functions use a stack data structure to store the
remainder obtained during the division method of conversion. Finally, the
program outputs the equivalent values in binary, octal, and hexadecimal.

Conclusion
Number system theory studies mathematical systems that describe how
numbers are represented and manipulated. There are several types of
number systems, including the decimal system, binary system, octal system,
and hexadecimal system, among others. The theory of number systems
includes concepts such as place value, conversion between different number
systems, addition, subtraction, multiplication, and division. It also includes
advanced topics such as modular arithmetic, number theory, and
cryptography. In computer science, number system theory is crucial in digital
electronics, programming languages, and computer networking.
Understanding the theory of number systems is essential for anyone who
wants to work in these fields. It also has applications in various other fields,
including finance, physics, and engineering.

Q1: Why is the binary number system used in computers?


Ans: Computers use binary number system because it is the simplest number
system to implement using electronic components. Binary system can
represent all data and instructions in a computer as a combination of 0 and 1,
which can be easily represented using electronic switches
What is the significance of different number systems in computer
programming?
Ans: Different number systems are used in computer programming to
represent and manipulate data in different ways. For example, the
hexadecimal number system is often used in computer programming because
it represents a more compact way of representing binary data. The choice of
number system depends on the specific application and requirements of the
computer system.

Q4: What is the purpose of using different number systems in


computers?
Ans: Different number systems are used in computers to represent and
manipulate data in different ways. For example, the binary number system is
used to represent data in a computer’s memory and in communication
between computer devices, while the hexadecimal number system is often
used in computer programming. The choice of number system depends on
the specific application and requirements of the computer system.

Number System conversion table

Binary Hexadecimal Denary


Value Value Value
0000 0 0
0001 1 1
0010 2 2
0011 3 3
0100 4 4
0101 5 5
0110 6 6
Binary Hexadecimal Denary
Value Value Value
0111 7 7
1000 8 8
1001 9 9
1010 A 10
1011 B 11
1100 C 12
1101 D 13
1110 E 14
1111 F 15

You might also like