Christopher Benson-Manica wrote:
> gabriel <> spoke thus:
>
>> Saurabh Saxena wrote:
>
>>> can we write the program to write no 1 to n without using
>>> switch,do,while,for,goto,if and conditional operator where n will be
>>> input by user.
>
>> Use recursion -- 'Nuff said
>
> How will you stop recursing without using conditionals?
>
No. The thing forbidden is the use of the conditional operator (?

.
You're allowed to use logical operators (I assume).
#include <stdio.h>
void print(int n) {
n && (print(n-1), 1) && printf("%d\n", n);
}
int main(void) {
print(10);
return 0;
}
-nrk.
--
Remove devnull for email