+ 2

Print numbers 1 toN without using semicolon and loop ?

#include<stdio.h> #define N 10 int main(int num) { if(num<=N&&printf("%d",num)&&main(num+1)) }

8th Jan 2017, 5:58 AM
Rehan hussain
Rehan hussain - avatar
1 Antwort
+ 1
I honestly don't know if it can be done without semicolons, but here's one with no loops in case it helps you: #include <stdio.h> #define N 10 int num=1; int main() { if (num<=N){ printf("%d ",num); num++; main(); } return 0; }
3rd Mar 2017, 7:06 PM
Pablo Santiago
Pablo Santiago - avatar