0

Cartesian product

Guys pls help me .. write a program which reads an array from the console and prints the product of ech of its elements with all elements E.g. for the array [1,7,3] the result would be [1*1, 1*7, 1*3 , 7*1 , 7*7 , 7*3 , 3*1 , 3*7, 3*3] Which gives as the array [1,7,3,7,49,21,3,21,9] So for the input 1 7 3 the program should print . 1 7 3 7 49 21 3 21 9 Guys i need help i need a code hehehe thankyou

8th Mar 2019, 6:13 AM
RicoJed Landar
RicoJed Landar - avatar
5 Antworten
+ 2
Please show us your attempt.
8th Mar 2019, 6:18 AM
Diego
Diego - avatar
+ 2
Hello RicoJed Landar You already post that kind post earlier please have some patience to answer anyone.. it's useless to post duplicate post. Hope you understand 😉
8th Mar 2019, 6:21 AM
Scooby
Scooby - avatar
+ 2
Use a nested loop. Choose any element from the array, and then run a loop multiplying the chosen element with all the elements of the array and print them. Then continue this process for the remaining elements of the array.
8th Mar 2019, 6:32 AM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar
0
CARTESIAN PRODUCT sir the input is >>> 3 173 The expected output is >>> 1 7 3 7 49 21 3 21 9
8th Mar 2019, 6:23 AM
RicoJed Landar
RicoJed Landar - avatar
0
Yess i tried to answer it . But i can't get the the right answer . so i posted it here to gain ideas . thanks :) ..
8th Mar 2019, 6:27 AM
RicoJed Landar
RicoJed Landar - avatar