没有循环打印1到n [英] without loop printing 1 to n

查看:71
本文介绍了没有循环打印1到n的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

没有得到

没有循环

怎么可能.....

在面试中被问到...


问候

MA

解决方案



Yahooooooooo写道:


no gotos

no loops

怎么可能....... br />
在采访中被问到...


问候

MA#



recusion?


void foo(int a,b){

if(a = b)then then return

else {

printf("%d \ n",a);

foo(a + 1,b);

}

}


Le 22-12-2006,Yahooooooooo< m。****** @gmail.comaécrit *:


no gotos

没有循环

怎么可能......
在采访中被问到...



递归


Marc Boyer




jd写道:


Yahooooooooo写道:


no gotos

没有循环

怎么可能.....

在面试中被问到...


问候

MA#



reusion?


void foo(int a,b ){

如果(a = b)然后返回

else {

printf("%d \ n",a);

foo(a + 1,b);

}

}



哎呀。太仓促,==平等,包括stdio.h等。


no gotos
no loops
how is it possbile.....
Asked in interview ...

Regards
MA

解决方案


Yahooooooooo wrote:

no gotos
no loops
how is it possbile.....
Asked in interview ...

Regards
MA#

recusion?

void foo(int a, b) {
if(a=b) then return
else {
printf("%d\n", a);
foo(a+1, b);
}
}


Le 22-12-2006, Yahooooooooo <m.******@gmail.coma écrit*:

no gotos
no loops
how is it possbile.....
Asked in interview ...

recursion

Marc Boyer



jd wrote:

Yahooooooooo wrote:

no gotos
no loops
how is it possbile.....
Asked in interview ...

Regards
MA#


recusion?

void foo(int a, b) {
if(a=b) then return
else {
printf("%d\n", a);
foo(a+1, b);
}
}

Whoops. Too hasty, == for equality, include stdio.h etc..


这篇关于没有循环打印1到n的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆