Aug 22, 2016 at 8:32am UTC
Why cant I get this to display anything when running in codeblocks?
#include <iostream>
using namespace std;
1 2 3 4 5 6 7 8 9 10 11 12
int main()
{
int s = 0;
int n = 0;
while (n <= 5);
{
cout << n << s;
s =+ n;//s = s + n
n++; // n = n + 1
}
Last edited on Aug 22, 2016 at 8:40am UTC
Aug 22, 2016 at 8:36am UTC
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#include <iostream>
using namespace std;
int main()
{
int s = 0;
int n = 0;
while (n <= 5) // <--
{
cout << n << s;
s += n;//s = s + n <---
n++; // n = n + 1
}
return 0;
}
0010213346510Program ended with exit code: 0
Last edited on Aug 22, 2016 at 8:37am UTC
Aug 22, 2016 at 9:10am UTC
Can you see the changes kermort made to your code?
Aug 23, 2016 at 7:07am UTC
yeah ...I see it now ...that's a silly mistake thank you