Write a program that will ask the user to give a number and then the program will compute its factorial value of the given number and display the result on the screen. The program also asks the user if the user will continue using the program or not. If the user chooses Y for yes the program will run again but if the user chooses N for no the program will display a thankful message and return to the operating system.
If you like my work please click the ads on my website to support my work. I will really appreciate your help.
I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details. If you want to advertise on my website kindly contact me also in my email address also. Thank you.
I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details. If you want to advertise on my website kindly contact me also in my email address also. Thank you.
My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.
My mobile number here in the Philippines is 09173084360.
My telephone number at home here in Bacolod City, Negros Occidental Philippines is +63 (034) 4335675.
Here in Bacolod I also accepting computer repair, networking and Arduino Project development at a very affordable price.
My personal website is http://www.jakerpomperada.com
Program Listing
# factorial.py
# Rollyn M. Moises and Jake R. Pomperada
# February 25, 2019 Tuesday
# Bacolod City, Negros Occidental
def factorial(number):
solve_results = 1
for i in range(2, number + 1):
solve_results *= i
return solve_results
def my_program():
print();
print("\t@==================================@")
print("\t Factorial of a Number ")
print("\t@==================================@")
print();
value = int(input("\tEnter a Number : "))
print("");
if value < 0:
print("\tSorry, factorial does not exist for negative numbers")
elif value == 0:
print("\tThe factorial of 0 is 1")
else:
print("\tThe factorial of",value,"is",factorial(value))
print();
repeat = input('\tDo you want to continue ? (Y/N) : ')
if repeat.upper() == "N":
print()
print("\tThank You For Using This Program.")
print();
print("\tEND OF PROGRAM");
quit
if repeat.upper() == "Y":
my_program()
if __name__ == '__main__':
my_program()
No comments:
Post a Comment