打印1到n没有任何条件语句,循环或跳转。 [英] print 1 to n without any conditional statement, loop or jump.
问题描述
你好朋友,
我是C编程的初学者。我的一个朋友让我在C写一个
程序。该程序的目的是打印1到n,没有任何
条件语句,循环或跳转。 />
怎么可能?请帮帮我。
提前致谢。
Hello friends,
I''m a beginner in C programming. One of my friends asked me to write a
program in C.The purpose of the program is print 1 to n without any
conditional statement, loop or jump.
How is it possible? Please help me.
Thanks in advance.
推荐答案
dev_cool写道:
dev_cool wrote:
你好朋友,
我是C编程的初学者。我的一个朋友让我在C写一个
程序。该程序的目的是打印1到n,没有任何
条件语句,循环或跳转。 />
怎么可能?请帮我。
Hello friends,
I''m a beginner in C programming. One of my friends asked me to write a
program in C.The purpose of the program is print 1 to n without any
conditional statement, loop or jump.
How is it possible? Please help me.
如果解决方案是我想到的那种,那不是那种初学程序员的b / b
练习需要。你会更好用
编写代码但忽略了没有。
当然你的朋友可能一直在考虑英语
一直没有做引号回答:
printf(1到%d \ n,n);
你需要声明和初始化`适当的。或者
甚至更加狡猾:
printf(1到n \ n);
或
printf(1到n没有任何条件语句,循环或跳转\ n);
您可以尝试K& R中的练习。 />
-
Chris" electric hedgehog" Dollin
这些快捷方式都是人们使用它们。
If the solution is the kind I''m thinking of, it''s not the sort of
exercise that a beginning programmer needs. You''d be better of
writing the code but ignoring the withouts.
Of course your "friend" might have been thinking of the "English
doesn''t do quotes consistently" answer:
printf( "1 to %d\n", n );
where you have to declare and initialise `n` appropriately. Or
the even cheatier:
printf( "1 to n\n" );
or
printf( "1 to n without any conditional statement, loop or jump\n" );
You could try the exercises in K&R.
--
Chris "electric hedgehog" Dollin
The shortcuts are all full of people using them.
dev_cool< su ******* @ gmail.com写道:
dev_cool <su*******@gmail.comwrote:
我是C编程的初学者。我的一个朋友让我在C中写了一个
程序。程序的目的是打印1到n,没有任何
条件语句,循环或跳转。
I''m a beginner in C programming. One of my friends asked me to write a
program in C.The purpose of the program is print 1 to n without any
conditional statement, loop or jump.
哦,你和老师一起喝啤酒吧?噢。那是很好的。现在,如果您只是给我们他们的电子邮件地址,我们将节省您的b / b
您将不得不交出您的作业。
(做你自己的作业,谢谢。虽然问题似乎很尴尬。)
-
C. Benson Manica |我*应该*知道我在说什么 - 如果我
cbmanica(at)gmail.com |不,我需要知道。火焰欢迎。
Oh, you have a beer with your instructor now and then? Aww. That''s
so sweet. Now if you''ll just give us his e-mail address we''ll save
you the trouble of having to hand your homework in.
(Do your own homework, thanks. Although the problem seems rather
silly.)
--
C. Benson Manica | I *should* know what I''m talking about - if I
cbmanica(at)gmail.com | don''t, I need to know. Flames welcome.
" dev_cool" < su ******* @ gmail.comwrites:
"dev_cool" <su*******@gmail.comwrites:
>朋友你好,我是C编程的初学者。我的一个朋友让我在C中写了一个
程序。程序的目的是打印1到n,没有任何
条件语句,循环或跳转。
>Hello friends,
I''m a beginner in C programming. One of my friends asked me to write a
program in C.The purpose of the program is print 1 to n without any
conditional statement, loop or jump.
目前还不清楚*为什么*人们会想要这样做,但是:
printf(" 1到n \ n");
可能是必需的解决方案。
更严重的是,它们可能是建议递归,但这需要
终止条件测试。
-
克里斯。
It''s very unclear *why* one would want to do this, but:
printf("1 to n\n");
might be the required solution.
More seriously, they may be suggestion recursion, but that will require a
conditional test to terminate.
--
Chris.
这篇关于打印1到n没有任何条件语句,循环或跳转。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!