Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2025 Foundation Course
NEET 2025 Foundation Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
1.8k views
in Fundamentals of Computer by (32.9k points)
closed by

What are the various ways to represent integers in computer?

1 Answer

+1 vote
by (30.7k points)
selected by
 
Best answer

There are three ways to represent integers in computer. 

They are as follows: 

1) Sign Magnitude Representation (SMR) 

2) 1’s Complement Representation 

3) 2’s Complement Representation . 

(1) SMR : Normally a number has: two parts sign and magnitude, 

eg:- Consider a number +5. Here + is the sign and 5 is the magnitude. In SMR the most significant Bit (MSB) is used to represent the sign. If MSB is 0 sign is +ve and MSB is 1 sign is – ve.

Here MSB is used for sign then the remaining 7 bits are used to represent magnitude. So we can represent 27 = 128 numbers. But there are negative and positive numbers. 

So 128 + 128 = 256 number. The numbers are 0 to + 127 and 0 to – 127. Here zero is repeated. So we can represent 256 – 1 = 255 numbers. 

2) 1’s Complement Representation : To get the 1’s complement of a binary number, just replace every 0 with 1 and every 1 with 0. Negative numbers are represented using 1’s complement but + ve number has no 1’s complement,

eg:- To find the 1 ‘s complement of 21 +21 = 00010101 

To get the 1 ‘s complement change all 0 to 1 and all 1 to 0. 

– 21 = 11101010

1’s complement of 21 is 11101010 

3) 2’s Complement Representation :

To get the 2’s complement of a binary number, just add 1 to its 1’s complement +ve number has no 2’s complement. 

eg:- To find the 2’s complement of 21 +21 = 00010101

First lake the 1’s complement for this change all 1 to 0 and all 0 to 1

2’s complement of 21 is 1110 1011

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

...