The month of February normally has 28 days. But if it is a leap year, February has 29 days. Write a program that asks the user to enter a year. The program should then display the number of days in February that year. Use the following criteria to identify leap years...
作业以散文形式包含逻辑/步骤;用注释编写步骤,然后将注释转换为代码。在
我已经完成了下面的第一部分,包括相关的“评论说明”。现在在每个注释下面写下代码。除此之外,代码应该包含if/then/else,并使用%(模数)运算符。在# 1. Determine whether the year is divisible by 100.
# If it is, then it is a leap year if and only if it is also divisible by 400 [otherwise it is not a leap year]
# 2. [otherwise, ] If the year is not divisible by 100,
# then it is a leap year if and only if it is divisible by 4 [otherwise it is not a leap year]
要构造代码清理器,请考虑将注释/逻辑放入函数中:
^{pr2}$
编码需要大量的练习。。所以练习一下:)