本文介绍了[不是问题]编写打印数字的程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
编写一个程序,打印从1到100的数字。但是对于三个打印的Fizz而不是数字的倍数和五个打印Buzz的倍数。对于三和五的倍数的数字打印FizzBuzz。
Write a program that prints the numbers from 1 to 100. But for multiples of three print "Fizz" instead of the number and for the multiples of five print "Buzz". For numbers which are multiples of both three and five print "FizzBuzz".
推荐答案我们不做你的作业:它是有原因的。它就是为了让你思考你被告知的事情,并试着理解它。它也在那里,以便您的导师可以识别您身体虚弱的区域,并将更多的注意力集中在补救措施上。 亲自尝试,你可能会发现它不是你想的很难! We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action. Try it yourself, you may find it is not as difficult as you think!
这是算法 循环1到100 开始 1.将数字除以3.如果结果为0则表示为3的倍数,打印Fizz 2.将数字除以5.如果结果为0则表示为5的倍数,打印Buzz 3.如果步骤1和步骤2结果为0,则打印FizzBuzz 4.如果步骤1或步骤2的结果不等于0,则只需打印该号码。 结束 Here's the algorithm Loop through 1 to 100 Begin 1. Divide the number by 3. If the result is 0 then it is said to be a multiple of 3 , Print "Fizz" 2. Divide the number by 5. If the result is 0 then it is said to be a multiple of 5 , Print "Buzz" 3. If Step 1 and Step 2 Results into 0 then print "FizzBuzz" 4. If Step 1 or Step 2 result is not equal to 0 then just print that number. End
更多推荐
[不是问题]编写打印数字的程序
发布评论