cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
need help with while loop!
need help with while loop!
Sep 23, 2011 at 6:06am UTC
mathnerd24
(15)
#include <iostream>
using namespace std;
int main() {
int n1, n2;
int i=n1;
cout << "Enter 2 numbers "<< endl;
cin >> n1, n2;
while (i<=n2){
cout << i << endl;
i = i+1;
}
return 0;
}
I can't get it to print integers between n1 to n2. thanks!
Last edited on
Sep 23, 2011 at 6:07am UTC
Sep 23, 2011 at 6:38am UTC
dznguy
(30)
n2 is never entered
try cin>> n1 >> n2;
Topic archived. No new replies allowed.