View Single Post
Old Jan 5th, 2006, 12:02 PM   #1
punter
Newbie
 
Join Date: Jan 2006
Posts: 2
Rep Power: 0 punter is on a distinguished road
A simple programming question

hi..
i was thrown this question yesterday from a friend of mine..


Using a single processor, an algorithm to compute the sum of eight numbers held in an array can be
expressed as follows:

set sum to zero
set counter to zero
WHILE counter < 8 Do
increment counter by 1
add number [counter] to sum
ENDWHILE
output sum


The same operation of summing eight numbers can be executed by using four processors in
parallel. Describe, how this could be done in C#?

Any suggestions?
i know you are grouping integers and possibly passing parameters.. but then since i have just started to learn C#, i can't exactly come up with such a code...
punter is offline   Reply With Quote