Python-02题

2020-07-29  本文已影响0人  AoEliauk

Question:

>Write a program which can compute the factorial of a given numbers.The results should be printed in a comma-separated sequence on a single line.Suppose the following input is supplied to the program: 8

>Then, the output should be:40320_**

注意:计算被给定数的阶乘,那么需要输入数字提供给这个问题,应该假设它是一个控制台输入。

Solution:

1.使用 while 循环

program result

2.使用 for 循环

program result

3.结合错误和异常情况编写

program result
上一篇下一篇

猜你喜欢

热点阅读