新人求助
编写一个程序,生成以下输出:For he's a jolly good fellow!
For he's a jolly good fellow!
For he's a jolly good fellow!
Which nobody can deny!
除了 main()函数以外,该程序还要调用两个自定义函数:一个名为jolly(),用于打印前 3 条消息,调用一次打印一条;另一个函数名为deny(),打印最后一条消息。 python吗? 如果是Python的话
def main():
jolly()
deny()
def jolly():
for i in range(3):
print("For he's a jolly good fellow!")
def deny():
print("Which nobody can deny!")
main() # 调用
结果:
For he's a jolly good fellow!
For he's a jolly good fellow!
For he's a jolly good fellow!
Which nobody can deny!
>>> newu 发表于 2019-7-3 16:59
如果是Python的话
是C语言 Server-bao 发表于 2019-7-3 17:04
是C语言
#include<stdio.h>
void jolly() {
printf("For he's a jolly good fellow!\n");
}
void deny() {
printf("Which nobody can deny!\n");
}
int main()
{
int i;
for (i=0; i<3; i++) {
jolly();
}
deny();
return 0;
}
页:
[1]