suite_a.py

Created by mathesciences

Created on December 10, 2022

231 Bytes

Suite arithmétique : Programme permettant de calculer les n premiers termes d’une suite arithmétique de 1er terme u1 et de raison r ainsi que la somme des n premiers termes


from math import *
def suite(u1,r,n):
  print ("u 1 =",u1)
  i=2
  un=u1
  while i<=n:
    un1=un+r
    print ("u",i,"=",un1)
    i=i+1
    un=un1
  S=n*(u1+un)/2
  print ("Somme des termes", S)
    
suite(3,5,10)
  

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our cookies policy.