Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Given the serial code that adds two vectors, convert the code into a parallel program and use it to find the sum of the elements

Given the serial code that adds two vectors, convert the code into a parallel program and use it to find the sum of the elements of the array given in the code. Submit your code.

// given the arrays

int[] a = { 4, 3, 1, 6, 8, 9, 100, 23, 13, 44, 14, 67, 89, 34, 23, 69, 100, 65, 32, 33, 4 ,5 ,6 ,18 };

int[] b = { 1, 7, 8, 4, 9, 12, 10, 3, 1, 14, 7, 7, 9, 3, 3, 6, 11, 165, 2, 1, 14, 15, 8, 33 };

int[] c = new int[a.Length];

// adds every item of the array to the sum

for (int i = 0; i < c.Length; i++)

{ c[i] = a[i] + b[i]; }

// Showing the elements of Array c

for (int i = 0; i < c.Length; i++)

{ Console.Write(c[i] + " "); }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning Apache Cassandra Development

Authors: Vivek Mishra

1st Edition

1484201426, 9781484201428

More Books

Students also viewed these Databases questions

Question

=+4. What do they (audience members) currently think?

Answered: 1 week ago