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
5 Respuestas
+ 2
Please show us your attempt.
+ 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 😉
+ 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.
0
CARTESIAN PRODUCT sir
the input is >>>
3
173
The expected output is >>> 1 7 3 7 49 21 3 21 9
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 :) ..