In: Computer Science
Write a program in C (NOT C++ or C#)
The program inputs 5 elements into each of 2 integer arrays.
Multiply corresponding array elements, that is, arrayOne[0] * arrayTwo[0], etc.
Save the product into a third array called prodArray[ ].
Display the product array.
SOURCE CODE:
*Please follow the comments to better understand the code.
**Please look at the Screenshot below and use this code to copy-paste.
***The code in the below screenshot is neatly indented for better understanding.
#include <stdio.h>
int main()
{
//Declare the arrays each of size 5
int arrayOne[5], arrayTwo[5], prodArray[5];
int i=0;
//Read the 5 numbers in First array and 5 numbers in
Second array
printf("Enter 5 numbers of first array: ");
for(i=0;i<5;i++)
scanf("%d",&arrayOne[i]);
printf("Enter 5 numbers of Second array: ");
for(i=0;i<5;i++)
scanf("%d",&arrayTwo[i]);
//Calculate the product and store it in
productArray
for(i=0;i<5;i++)
prodArray[i] = arrayOne[i] * arrayTwo[i];
//print the prodArray
printf("The Product array is: ");
for(i=0;i<5;i++)
printf("%d ",prodArray[i]);
return 0;
}
=================================
SCREENSHOT: