## Exercice 2 print("Bonjour") 2*7 print(3*7) 4*7 a=5*7 print(a) ## Exercice 3 for i in range(1,7): print(i**2) ## Exercice 5 x=10 y=16 z=x+y x=y y=z print(x+y+z) ## Exercice 9 for i in range(10,15): print("bonjour"+str(i)) ## Exercice 10 if 10**2<99: print('Paf') if 5**2>20: print('Pif') if 10**2<99 or 5**2>20: print('Pof') if 10**2<99: print('Paf') if 5**2>20: print('Pif') if 10**2<99 or 5**2>20: print('Pof') ## Exercice 11 somme=0 for i in range(1,5): somme=somme+i print(i,somme) ## Exercice 12 somme=0 for i in range(10,18): if i%3==0: somme=somme+i print(somme) ## Exercice 13 for n in range(20): if n%2==0: print(n,"est pair.") else: print(n,"est impair.") for n in range(1,1001): if n%7==0: print(n) ## Exercice 14 f=1 for k in range(1,11): f=f*k print('10!=',f) f=1 for k in range(1,101): f=f*k print('100!=',f) f=1 for k in range(1,1001): f=f*k print('1000!=',f) ## Exercice 15 S=0 for k in range(10,101): S=S+k**2 print(S) ## Exercice 16 S=0 for k in range (1,1000): if k%3==0 or k%5==0: S=S+k print(S) ## Exercice 17 n=int(input('Valeur de n : ')) for k in range(1,11): print(n,'*',k,'=',n*k) ## Exercice 18 n=2005001 b=1 for k in range(2,n): if n%k==0: b=0 if b==1: print(n,' est premier. ') else: print(n," n'est pas premier. ") n=2005007 b=1 for k in range(2,n): if n%k==0: b=0 if b==1: print(n,' est premier. ') else: print(n," n'est pas premier. ") for k in range(2,n): if n%k==0: print(k) n=n/k print(n) n=2000009000009 b=1 for k in range(2,1500000): if n%k==0: b=0 if b==1: print(n,' est premier. ') else: print(n," n'est pas premier. ") for k in range(2,1500000): if n%k==0: print(k) n=n/k print(n)