#include <stdio.h> #define N 10 int main() { if(printf("1\n")) {} #define PRINT(N) if(printf("%d\n", N) && N < 10) PRINT(N+1) PRINT(2); return 0; }
Inside the main() function:
- The program uses preprocessor directives to define the value of `N` as 10.
- The first natural number, 1, is printed using the `printf` function inside the `if` statement.
- A macro `PRINT(N)` is defined to recursively print natural numbers from 2 up to `N` without using a semi-colon.
- The macro `PRINT(N)` calls itself with incremented value of `N` if `N` is less than 10.
- The program then calls the `PRINT` macro with the initial value of 2 to start printing natural numbers.