Intro to Programming - Decimal, Binary, Octal, and Hexadecimal conversions / Signed Integers

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

hexadecimal

-base 16 -has 16 digit symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F

binary

-base 2 -has 2 digit symbols: 0, 1

octal

-base 8 -has 8 digit symbols: 0, 1, 2, 3, 4, 5, 6, 7

converting octal to binary

-convert each individual digit in the number to three binary digits ex. 23 2 = 010 , 3 = 011 answer: 010011

converting hex to octal

-convert hex to binary -mark in groups of 3 from right to left -translate each group ex. 7C4 011111000100 011 111 000 100 011 = 3 , 111 = 7 , 000 = 0 , 100 = 4 answer: 3704

converting octal to hex

-convert octal to binary and then binary to hex -

converting decimal to hex

-divide decimal number by 16 -keep dividing answer by 16 until you get 0 -the answer is remainders of each, from last to first ex. 1988 1988/16 = 124 remainder 4 124/16 = 7 remainder 12 = C 7/16 = 0 remainder 7 answer: 7C4

converting decimal to octal

-divide the decimal number by 8 -keep dividing the answer by 8 until you get 0 -answer is the remainders of each, from last to first ex. 1988 1988/8 = 248 remainder 4 248/8 = 31 remainder 0 31/8 = 3 remainder 7 3/8 = 0 remainder 3 answer: 3704

converting binary to hex

-mark groups of four from right to left -translate each group ex. 10101011 1010 1011 10 = A , 11 = B answer:

converting binary to octal

-mark groups of three from right to left -translate each group ex. 10101011 10 101 011 10 = 2 , 101 = 5 , 011 = 3 answer: 253

forming two's complement

-reverse each bit in the original value -add 1 to that value -the sum is answer

how to get twos complement

-write out the number in binary -invert the digits -add one to the result

decimal

base 10

two's complement

negative #'s are stored in two's complement notation

signed integers

the first bit indicates the sign. 1 = negative, 0 = positive

twos complement explanation

the two's complement of an N-bit number is defined as its complement with respect to 2N


Set pelajaran terkait

Health and Welfare Plans Strategic Planning and Design

View Set

W8- Introduction to analysis of variance (ANOVA)

View Set

Chapter 31: Caring for Clients with Disorders of the Hematopoietic System

View Set

Module 9 Reading Assignment - Cardiovascular Diseases

View Set

Chapter 14: Statute of Frauds and Equitable Exceptions

View Set