For example the given array is {2,3,4,5}, we have to get the output as multiple of 3 * 4 * 5 = 60, in next line we have to get the multiple of 2 * 4 * 5 = 40, in next line we have to get the multiple of 2 * 3 * 5 = 30 and in next line we have to get the multiple of 2 * 3 * 4 = 24
Input: {2,3,4,5}
Output:
60
40
30
24
The source code is written below:
a= [1,2,3,4]
b=array('i')
for i in range(0,len(a)):
b.append(1)
for i in range(0,len(a)):
for j in range(0,len(a)):
if i!=j:
b[i]*=a[j]
for i in b:
print(i)
Input: {2,3,4,5}
Output:
60
40
30
24
The source code is written below:
Program:
from array import *a= [1,2,3,4]
b=array('i')
for i in range(0,len(a)):
b.append(1)
for i in range(0,len(a)):
for j in range(0,len(a)):
if i!=j:
b[i]*=a[j]
for i in b:
print(i)
Output:
24
12
8
6

0 Comments