+ 1
Print all natural numbers upto N without using semi-colon.
We use the idea of recursively calling main function.
4 Answers
+ 2
code??
+ 2
// A recursive C program to print all numbers from 1
// to N without semicoolon
#include<stdio.h>
#define N 10
int main(int num)
{
 if (num <= N && printf("%d ", num) && main(num + 1))
  {
}Â Â Â
}
+ 1
//with N default as 10
#include <iostream>
int fn(int i, int x) {
while(i<=x && std::cout<<i<<std::endl && i++ ){}
}
int main(int i, char **c){
if( ( i && i > 1 && fn(1,i)) || (i==1 && main(10, c)))
{}
}
0
see this example in the playground
https://code.sololearn.com/cHSOOwfG7RD7/?ref=app