Skip to content

Commit af49eb4

Browse files
try
1 parent 6083e56 commit af49eb4

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

OOPS/Product_of_array.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
na=int(input("Enter the Length of array: "))
2+
nums=[]
3+
for i in range(na):
4+
num=int(input("enter number : "))
5+
nums.append(num)
6+
n=len(nums)
7+
post=[1]*n
8+
prefix=1
9+
for i in range(n):
10+
post[i]=prefix
11+
prefix*=nums[i]
12+
postfix=1
13+
for i in range(n-1,-1,-1):
14+
post[i]*=postfix
15+
postfix*=nums[i]
16+
print(post)

OOPS/tempCodeRunnerFile.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
na=int(input("Enter the Length of array: "))
2+
nums=[]
3+
for i in range(na):
4+
num=int(input("enter number : "))
5+
nums.append(num)
6+
n=len(nums)
7+
post=[1]*n
8+
prefix=1
9+
for i in range(n):
10+
post[i]=prefix
11+
prefix*=nums[i]
12+
postfix=1
13+
for i in range(n-1,-1,-1):
14+
post[i]*=postfix
15+
postfix*=nums[i]
16+
print(post)

0 commit comments

Comments
 (0)