zy55. Multple arrays E please Help C..Propr × (GMhply each element : #5 x 18/cha
ID: 3724280 • Letter: Z
Question
zy55. Multple arrays E please Help C..Propr × (GMhply each element : #5 x 18/chapter/S/section/s t resource id 23317637 re https//learn.zybooks.com/zybook/UNTCSCE1030ShresthaSpring201 Sur College of Engineerie Q.Challenge Probl ary> CSCE 1030 home>5.5: Multiple arrays zyBooks catalog Reset Multiply each element in origList with the corresponding value in offsetAmount. Print each product followed by a space Ex If origList (4,5, 10, 12) and offsetAmount (2,4,7,3), print 8 20 70 36 ·include using nmspace std; s int maino 6const int NUMALS 9nt 12 origiist[]1 int origuist [MUPL WALS) int offsetamount[UL WALS] 17 offsetamount11 21- r. Your solution edes here. Check Next Feedback? ere to searchExplanation / Answer
#include <iostream>
#include <string.h>
using namespace std;
int main() {
const int NUM_VALS= 4;
int origList[NUM_VALS];
int offsetAmount[NUM_VALS];
int i;
origList[0] = 40;
origList[1] = 10;
origList[2] = 30;
origList[3] = 20;
offsetAmount[0] = 4;
offsetAmount[1] = 6;
offsetAmount[2] = 2;
offsetAmount[3] = 8;
// looping through each element and printing the multiplied value
for(int i=0; i<NUM_VALS; i++)
{
cout << origList[i]*offsetAmount[i] << " ";
}
}
// Output: 160 60 60 160
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.