Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Does anyone know how to Subtract and Add Octal??
Index -> General Programming
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Kenster102.5




PostPosted: Mon Apr 07, 2008 9:15 pm   Post subject: Does anyone know how to Subtract and Add Octal??

So I know that Octal is Base 8 and is in 3 bit chunks(group of 3 numbers). I am wondering how do I subtract or add if the number is bigger then the base.
Here are 2 questions

365
+234


601
- 357

So someone please help me since, it is for my Grade 11 Engineering Class, and please Step by Step.
Thank you.
Sponsor
Sponsor
Sponsor
sponsor
rdrake




PostPosted: Mon Apr 07, 2008 9:35 pm   Post subject: Re: Does anyone know how to Subtract and Add Octal??

Well, let's go through a simple question:
342 + 760

We set it up like normal:
code:

 342
+760
----


First we do 2 + 0, which is 2.
code:

 342
+760
----
   2


Then we do 4 + 6 since there is no carry.
code:

  1
 342
+760
----
  22

There is a carry of 1, since 4 + 6 is 10 which is 2 greater than 8.

Then we do 3 + 7 + 1:
code:

11
 342
+760
----
 322

3 + 7 + 1 is 11, which is 3 greater than 8. So we have a value of 3, and a carry of 1.

Since there's nothing left to add, we just add the carry of 1 and we're done.
code:

11
 342
+760
----
1322


I'm quite sure subtraction works in a very similar way.
Kenster102.5




PostPosted: Tue Apr 08, 2008 5:55 am   Post subject: RE:Does anyone know how to Subtract and Add Octal??

Thank you so much, I now understand it some what.
Display posts from previous:   
   Index -> General Programming
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: