Friday, April 9, 2010

print 1-100 no.swithout loop in c

globalStr,i);

  scanf("%d",&n);
  nprint(n);
  return 0;
}

For CPP, there is a better method,
#include

class a{
public:
a(){std::cout<<++i<}
private:
static int i;
};

int a::i;

int main(){
int n=0;
std::cout<<"Enter the maximum number that you want to print: ";
std::cin>>n;
a* array=new a[n];
//system("pause");
return 0;
}

No comments:

Post a Comment