Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from numpy import array
- t=array([int()]*100)
- tc=array([int()]*100)
- td=array([int()]*100)
- def saisir():
- while True:
- n=int(input("donner la taille de tableau:"))
- if 4<n<20: break
- return n
- def remplir(n):
- for i in range(n):
- t[i]=int(input("T["+str(i)+"]="))
- return t
- def somme(t,n):
- for i in range(n):
- ch=str(t[i])
- sc=0
- for j in range (0,len(ch)):
- sc=sc+int(ch[j])
- tc[i]=sc
- return tc
- def produit(t,n):
- for i in range(n):
- sd=0
- for k in range (1,t[i]+1):
- if t[i]%k==0:
- sd=sd+k
- td[i]=sd
- return td
- def afficher(t,n):
- for i in range(n):
- print(t[i],end="|")
- print()
- n=saisir()
- t=remplir(n)
- tc=somme(t,n)
- td=produit(t,n)
- afficher(t,n)
- afficher(tc,n)
- afficher(td,n)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement