Skip to main content
ICT
Lesson A21 - Number Systems
 
Main Previous Next
Title Page >  
Summary >  
Lesson A1 >  
Lesson A2 >  
Lesson A3 >  
Lesson A4 >  
Lesson A5 >  
Lesson A6 >  
Lesson A7 >  
Lesson A8 >  
Lesson A9 >  
Lesson A10 >  
Lesson A11 >  
Lesson A12 >  
Lesson A13 >  
Lesson A14 >  
Lesson A15 >  
Lesson A16 >  
Lesson A17 >  
Lesson A18 >  
Lesson A19 >  
Lesson A20 >  
Lesson A21 >  
Lesson A22 >  
Lesson AB23 >  
Lesson AB24 >  
Lesson AB25 >  
Lesson AB26 >  
Lesson AB27 >  
Lesson AB28 >  
Lesson AB29 >  
Lesson AB30 >  
Lesson AB31 >  
Lesson AB32 >  
Lesson AB33 >  
Vocabulary >  
 

B. Review Decimal page 4 of 11

  1. In reviewing our number system, let’s look at what the number 1234 means to us. We are taught very early on about place values. In the decimal number system, starting at the rightmost digit we have the ones place, then the tens place, hundreds place, and finally the thousands place. We are only allowed the digits 0 through 9. The number 1234 represents the following components:

    1*1000 + 2*100 + 3*10 + 4*1

    or

    1*103 + 2*102 + 3*101 + 4*100

    We are very accustomed to using decimal numbers so we do not think about breaking a number into its components. However, it is important to learn and understand what numbers represent, often by using hands-on activities.

    Example: Given an integer variable num, reverse the number. If we knew there were three digits, we could

    int a = num/100;
    int remainder = num%100;
    int b = remainder/10;
    int c = remainder%10;
    //now we could reassemble it
    num = c*100 + b*10 + a;

    This is similar to what we did in Lab Assignment A3.2, Coins.

    If we do not know how many digits are in the number, we could use a loop.

  2. int x = 12345;
    int newX = 0;
    int temp = 0;
    while(x > 0){
          temp = x%10;
          newX = newX * 10 + temp;
          x /= 10;
    }
    x = temp;

  3. If we move to the right of the decimal place, we start using negative exponents.
    103
    102
    101
    100
    10-1
    10-2

     

 

Main Previous Next
Contact
 © ICT 2006, All Rights Reserved.