Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Need help with my C++ code PLEASEEEEE i dont need a main function it is built in

ID: 3599659 • Letter: N

Question

Need help with my C++ code PLEASEEEEE

i dont need a main function it is built in to the autograded compilor. I just need this function. thanks :). Also all librarys etc are built into the compilor.

Write a function multiplicationOfArrays which takes four parameters: two arrays (X and Y) and their sizes. The function should find the sum of multiplication of each element of X with all elements of Y The function should return the final sum. int multiplicationOfArrays(int XI, int size1, int YI, int size2) Example X = {2,3,4,5,6} Y = {3,4,5) calculation: (2*3 +2*4 + 2"5) (3*3+3*4+3*5)+(4*3 +4*4+4*5)+(5*3+5*4+5*5)+(6"3+6"46"5) Output: 240

Explanation / Answer


#include <iostream>
#include <iomanip>
using namespace std;
int multiplecationOfArrays(int X[], int size1, int Y[], int size2) {
int total = 0;
for(int i=0;i<size1;i++){
for(int j=0;j<size2;j++){
total=total + (X[i]*Y[j]);
}
}
return total;
}
int main()
{
int X[5] = {2,3,4,5,6};
int Y[3] = {3,4,5};
cout<<"Result: "<<multiplecationOfArrays(X, 5, Y, 3)<<endl;
return 0;
}

Output:

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote