write a program to display numbers upto n

A number n is taken from the user and then numbers from 1 to n is displayed.


Select To use this code as it is.. select and copy paste this code into code.cpp file :)



  1. #include<iostream.h>
  2. #include<conio.h>
  3. void main()
  4. {
  5. clrscr();
  6. int lim;
  7. cout<<"Please enter Limit: ";
  8. cin>>lim;
  9. //Coding by: Snehil Khanor
  10. //http://WapCPP.blogspot.com
  11. for(int i=1;i<=lim;i++)
  12. { cout<<i;
  13. cout<<"\n";
  14. }
  15. getch();
  16. }

Check out this stream