1. Help with my program please :)

Anyways I am trying to create a program that counts all the prime numbers between 1 and 500. Its executing with no errors or warnings but there is no output
Code:
```#include <iostream.h>
//this program is made to count all
//the prime numbers between 1 and 500
int main()
{
int i=1;
int n=2;
int prime=0;

for(i=1;i<500;i++)
{
for(n=2;n<500;n++)
{
if (i%n==0) break;
}
if ( n==(i-1) )
{
cout << i; // all the prime numbers
cout << prime; //number of primes
prime++;
}
}
return 0;
}```

2. dont u need to create a function which will output ur result on the screen?

3. Code:
```			for(n=2;n<500;n++)
{
if (i%n==0) break;
}
if ( n==(i-1) )
{
cout << i; // all the prime numbers
cout << prime; //number of primes
prime++;
}```
should be:
Code:
```			for(n=2;n<500;n++)
{
if (i%n==0) break;
if ( n==(i-1) )
{
cout << i; // all the prime numbers
cout << prime; //number of primes
prime++;
}
}```

4. Thanks for the help guys, I worked on it a bit more and came up with:
Code:
```#include <iostream.h>
//this program is made to count all
//the prime numbers between 1 and 500
int main()
{
int i=1;
int n=2;
cout << 2 << " ";
for (i = 1; i < 500; i++)
{
for (n = 2; n < (i - 1); n++)
{
if (i % n == 0)
{
break;
}
}
if (n == (i - 1))
{
cout << i << " ";
}
}
return 0;
}```
well a friend helped :]

5. >if (n == (i - 1))
The if statement is redundant. You don't need it at all.

6. hey i tryed ur code too with the correction jlou posted i added the following
Code:
```cout << n; // all the numbers
cout << "\nprime: " <<i<<"\n"; //all primes```
that works too