0
Where is the problem?
#include <iostream> using namespace std; int main() { int n, s=0; cout<< "n"; cin>> n; s=s+1; if(s<n) { cout<< s<<endl; } }
3 Answers
+ 10
You need to use loop for that kind of output.
int n = 0;
cin >> n;
int s = 0;
while(s <= n)
{
cout << s << endl;
s++; //s = s + 1
}
+ 1
What result are you aiming for?
And what happens instead?
0
result is 1.
I wanna for ex.n=8 012345678