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 !
-

Python pour le Lycée : Un Guide Complet en Seconde, Première et Terminale
€ 14,00 Acheter le livre -

Répéteur WiFi,1200Mbps Dual Band 2.4G / 5G WiFi Amplifier,WiFi Signal Booster,2 Ports LAN ,4 Antennes,WiFi Extenders
€ 18,00 Acheter le produit -

Apprendre Raspberry Pi 3 ou Pi Zero sur Nano-Ordinateur
€ 29,00 Acheter le livre
1 thought on “Solution Exercise 9: python program that compute the factorial of an integer n”