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; } }

27th Nov 2018, 5:36 PM
Hasan Aydın
Hasan Aydın - avatar
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 }
27th Nov 2018, 7:23 PM
blACk sh4d0w
blACk sh4d0w - avatar
+ 1
What result are you aiming for? And what happens instead?
27th Nov 2018, 6:14 PM
HonFu
HonFu - avatar
0
result is 1. I wanna for ex.n=8 012345678
27th Nov 2018, 6:58 PM
Hasan Aydın
Hasan Aydın - avatar