User Tools

Site Tools


haas:spring2014:cprog:projects:vertcross

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
haas:spring2014:cprog:projects:vertcross [2014/03/13 09:25] – [Execution] wedgehaas:spring2014:cprog:projects:vertcross [2014/03/13 09:42] (current) – [Multiplying two double digit numbers together] wedge
Line 77: Line 77:
       4        1         1       4        1         1
               2         0               2         0
 +              
 +      4+2      1         1
 +      
 +      6        1         1
                              
               = 611               = 611
Line 87: Line 91:
 In this case we merely extend the pattern of vertically and crosswise, namely: In this case we merely extend the pattern of vertically and crosswise, namely:
  
-  * there are 3 columns to multiply vertically +  * multiply right-most column vertically (ones place) 
-  * there are 2 crosswise operations to perform+  * multiply crosswise the two right-most columns (tens place) 
 +  * multiply crosswise the left- and right-most columns, vertically multiply the middle (hundreds) 
 +  * multiply crosswise the two left-most columns (thousands) 
 +  * multiply vertically the left-most column (ten thousands) 
 + 
 +Note the stretching/expanding approach that is taken here-- with each successive place, the range of columns involved in that position's calculation grows (including an additional column to the left with each position), until all columns are involved, then we shrink it progressively one column at a time (removing columns from the right) as we wane down to a single column on the left.
  
 Let's look at 123 x 234: Let's look at 123 x 234:
Line 95: Line 104:
    123    123
  x 234  x 234
- ------- + -------        carry_in 
-  (1x2)         (2x3)         (3x4   the vertical multiplications +     3x4          [+ 0] ones place    (sum of 2 carry out of 1) 
-      (1x3)+(2x2)   (2x4)+(3x3       the crosswise operations +    2x4 3x3      + 1  tens place    (sum of 8 carry out of 1) 
-             (1x4)+(2x3)               an outer-most crosswise operation +   4x1 + 2x3 2x3 + 1  hundreds      (sum of 7 carry out of 1
-  --------------------------------- +  1x3 2x2        + 1  thousands     (sum of 8 carry out of 0) 
-    02   06    12                      as this is a 3 digit problem, we need places + 2x1               + 0  ten thousands (sum of carry out of 0) 
-      3+4   8+9 + 
-         4+6 +  We then take the sums from each operation and place them as appropriate 
-  ------------------ + in their position in the final number (ones place is furthest on the right). 
-    020612 + 
-     0717 + 123 x 234 = 28782
-      10 +
-    ------ +
-    028782 = 28782 (as a leading zero does not impact the value at all)+
 </code> </code>
  
 A dual benefit of this project is that in addition to extending your programming experience / understanding of C, you could develop this as a mental ability (that is where it originated), and you could then use it as a means of checking your work. A dual benefit of this project is that in addition to extending your programming experience / understanding of C, you could develop this as a mental ability (that is where it originated), and you could then use it as a means of checking your work.
- 
 ====Another depiction==== ====Another depiction====
 Here is another, more illustrative, method of solving a problem using the vertical and crosswise method: Here is another, more illustrative, method of solving a problem using the vertical and crosswise method:
Line 165: Line 170:
 </cli> </cli>
  
-=====Reflection===== 
-Be sure to provide any commentary on your opus regarding realizations had and discoveries made during your pursuit of this project. 
- 
-  * Can this process be extended for four digit numbers? 
-  * How about five digit numbers? 
  
 =====Submission===== =====Submission=====
haas/spring2014/cprog/projects/vertcross.1394702728.txt.gz · Last modified: 2014/03/13 09:25 by wedge