View the step-by-step solution to:

# Need help with a Java program that takes two arrays a and b of length 5 storing int values, and returns the dot product of a and b. That is, it

Need help with a Java program that takes two arrays a and b of length 5 storing int values, and returns the dot product of a and b. That is, it returns an array c of length n such that c[i]=a[i]*b[i].

The result of the program is enter number of elements of a 5 enter number of... View the full answer

• C is supposed to be an array which here you here I think its result and it is not an array
• mounatraore93
• Sep 30, 2018 at 6:18pm
• int c[] = null; {instead of int sum = 0;} and c[i]+=( a[i]+b[i] ); {instead of sum += a[i] * b[i];}
• Tewatia_shelly
• Sep 30, 2018 at 7:38pm
• c[i]+=( a[i]*b[i] ); not + use *
• Tewatia_shelly
• Sep 30, 2018 at 7:39pm

Java program public class HelloWorld {       public static void main ( String []args ) {     int a[] = { 2 , 3... View the full answer

• Hey nice work. Did you use this variables int n = 5, k = 3 anywhere in the code
• mounatraore93
• Sep 30, 2018 at 5:18pm
• No I didn't use , i have initialized the array with fixed five values but you can input both arrays at run time also by declaring size of an array n=5
• artibisht
• Sep 30, 2018 at 5:23pm
• C is supposed to be an array which here you here I think its sum and it is not an array
• mounatraore93
• Sep 30, 2018 at 6:17pm

Output: ﻿ run: Please enter size of array a 5 Please enter size of array b 5 Please enter... View the full answer

### Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

### -

Educational Resources
• ### -

Study Documents

Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

Browse Documents