# subtracting from 2 arrays of integers

Page 1 of 1

## 2 Replies - 539 Views - Last Post: 30 March 2013 - 08:19 AMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=317201&amp;s=9afcb8c898e4e07d2052e96577e1e1ea&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 mil1234

Reputation: 4
• Posts: 109
• Joined: 01-February 09

# subtracting from 2 arrays of integers

Posted 30 March 2013 - 07:41 AM

Hi Guys,

i have a requirement where i have to minus (and then eventually also multiply and divide) numbers that are in an array:

pseodu type example:

int nos[] = {2,4,5,6,2,3} -
int nos2[] = {1,3,4,3,1,5}

therefore i have in some way make the subtraction like it is done on paper eg - start from 3 less 5 go and borrow from 2 etc etc..Can anyone provide me with some example on how i should go about developing this requirement. With this i will hopefully be then able to do also the other arithmetic requirements

Thanks....

This post has been edited by mil1234: 30 March 2013 - 07:46 AM

Is This A Good Question/Topic? 0

## Replies To: subtracting from 2 arrays of integers

### #2 Michael26

Reputation: 366
• Posts: 1,551
• Joined: 08-April 09

## Re: subtracting from 2 arrays of integers

Posted 30 March 2013 - 07:55 AM

You do know that arrays are accessed via indexes, get the value in the index and apply the desired operation.

### #3 tlhIn`toq

Reputation: 5859
• Posts: 12,756
• Joined: 02-June 10

## Re: subtracting from 2 arrays of integers

Posted 30 March 2013 - 08:19 AM

Loop through the array.
There are so many tutorials out there that this question borders on 'gimme teh codez'. At best its just sheer laziness that you can't be bothered to read your text book.