- Back to Home »
- C++ Program to Print Numbers From 1 to n Without Using Loops, Recursion or Go to Statement
Posted by : Unknown
#include<iostream>
using namespace std;
class Num
{
public:
static int i;
Num()
{
cout<<i++<<" ";
}
};
int Num::i=1;
int main()
{
int n;
cout<<"Enter value on n:";
cin>>n;
Num obj[n];
return 0;
}