Question: Using C Q2 Write a program that does the following: i) Defines an integer array arr[20] {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20); and an integer target array target [5 10,20,40,100,570;
Using C

Q2 Write a program that does the following: i) Defines an integer array arr[20] {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20); and an integer target array target [5 10,20,40,100,570; ii)Lists all pairs of numbers whose product is in the target array iii) Uses for loops to solve the problem iv) Prints output in the following format: Pairs with product 10: Pairs with product -20: (1, 20) (2, 10) (4, 5) Pairs with product- 570: //No pair found NOTE: In order to test the program we will be changing the contents of arr[20] and target[5] Pairs with product -10: Pairs with product- 20: (1, 20) (2, 10) (4, 5) Pairs with product 40 (2, 20) (4, 10) (5, 8) Pairs with product 100: (5, 20) (10, 10) Pairs with product-570: No pair found
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
