C Program to print numbers from 1 to 10 without using semicolon


We can create some program without using the semicolon. You may solve this problem by follows steps.
Here we are providing the simplest method for print numbers from 1 to 10 without using the semicolon.
How to print numbers from 1 to 10 number without using any semicolon in C.

How To print numbers from 1 to 10 without using semicolon

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

Output:-

1 2 3 4 5 6 7 8 9 10

Explanation of Program :

In this program, I pass a variable into the main method that is int main(int num) after that I checked condition here that is given below.
int main(int num)
if(num<=N && prinf(“%d”,num) && main(num+1))
Here num default value is 0
Then check condition
if( num <= 10) then it will print here until condition does not false.