Exercise 9.
Write a program in Python that asks the user to enter an integer n and display n!
Solution
1 2 3 4 5 6 7 8 |
# Ask the user to enter the value of the integer n n = int(input("Type a value of the integer n ")) # define and initialize an factorial of n facto = 1 for i in range(1,n+1): facto = facto*i print("Factorial of n is: ",n,"! =: ", facto) |
Younes Derfoufi
CRMEF OUJDA
Acheter sur Très Facile !
-
Promo !
Apprendre Python un guide complet et progressif
Le prix initial était : € 11,00.€ 10,00Le prix actuel est : € 10,00. Ajouter au panier -
Kit Python FRANZIS 67183 Mach's : Raspberry Pi 4 et 400
€ 56,00 Acheter le produit -
Créer Votre Site Avec WordPress : Un Guide Pratique
€ 13,00 Acheter le livre
1 thought on “Solution Exercise 9: python program that compute the factorial of an integer n”