2-part programs

I created a basic C++ program that sums all integers from 1 to n, but the second part of my code is supposed to print all numbers in the set evenly divisible by 11...only it doesn't. Is there something wrong with my code? I'm a little frustrated...

My program:
#include <iostream>
using namespace std;

int main()
{
int SUM = 0;
int count = 1;
int n;

cout<<"Enter an positive integer greater than 1:";
cin>>n;

for (count = 1; count <= n; count ++)
{
SUM = SUM + count;
}
cout<<"The sum of"<< n << "integers is" << SUM <<endl;


int z = 11;
int y;
for (n = 1; n != z; n++)
{y = n % z;
if (y == 0)
{
cout<<n<<"is evenly divisible by 11.";
}
}
return 0;
}

The program does the sum correctly, but never tells the user if any numbers in the set are divisible by 11. Did I use the modulus operator incorrectly?
In the second for, replace n with count and change the loop condition to count <= n
That helped a lot. Thank you. I replaced n with count and changed the loop and termination conditions. There's a little bug because the second cout statement prints n number of times, but I can live with it. Thanks again!
Topic archived. No new replies allowed.