/*C program to print n natural numbers without using any loop*/
#include <stdio.h>
#include <conio.h>
void main()
{
int n, c = 1;
printf("Enter a number to End=");
scanf("%d", &n); // Value of n should be >= 1
print: // label
printf("%d\n", c);
c++;
if (c <= n)
goto print;
getch();
}
Expected Output:
Enter a number to End=10
1
2
3
4
5
6
7
8
9
10
#include <stdio.h>
#include <conio.h>
void main()
{
int n, c = 1;
printf("Enter a number to End=");
scanf("%d", &n); // Value of n should be >= 1
print: // label
printf("%d\n", c);
c++;
if (c <= n)
goto print;
getch();
}
Expected Output:
Enter a number to End=10
1
2
3
4
5
6
7
8
9
10
Tags:
natural number print
printing natural numbers without using any loop
without loop natural number
without loop numbers
without loop.