Samuel Vermeulen 4 weeks ago
parent
commit
d0bbde4a39
  1. 15
      pyramide.py

15
pyramide.py

@ -1,13 +1,10 @@
nbPierres = int(input())
pierre = 0
surEtage = 0
nbTotalPierres = 0
etage = 1
while nbPierres > 0:
pierre +=1
surfEtage = pierre ** 2
nbTotalPierres = nbTotalPierres + surfEtage
nbPierres = nbPierres - nbTotalPierres
while pierre + etage ** 2 <= nbPierres:
pierre = pierre + etage ** 2
etage +=1
print(pierre)
print(nbTotalPierres)
print(etage - 1)
print(pierre)
Loading…
Cancel
Save