Prime numbers
as a test for chapter 2 the task was to make a program that can find the prime numbers between 1 and 100. i tried it and i failed. tried again and succeeded.
i googled if 1 is a prime nr but it isn't.
but under no circumstance i can let it show the nr 1 (yeah i know it is not a prime number but i still want it to be possible).
can someone check if the code is alright or can be shortened?
or to make it possible to make the 1 show up.

i googled if 1 is a prime nr but it isn't.
but under no circumstance i can let it show the nr 1 (yeah i know it is not a prime number but i still want it to be possible).
can someone check if the code is alright or can be shortened?
or to make it possible to make the 1 show up.
#include <iostream>
using namespace std;
int main ()
{
int prime, checker, residu;
bool addprime;
residu = prime%checker;
for (prime = 1;prime <=100; prime++)
{
for (checker = 1; checker <prime; checker++)
{
residu = prime%checker;
if (residu ==0)addprime = false;
if (checker ==1)addprime = true;
}
if (addprime == true) cout << prime<< endl;
}
system ("pause");
return 0;
}
using namespace std;
int main ()
{
int prime, checker, residu;
bool addprime;
residu = prime%checker;
for (prime = 1;prime <=100; prime++)
{
for (checker = 1; checker <prime; checker++)
{
residu = prime%checker;
if (residu ==0)addprime = false;
if (checker ==1)addprime = true;
}
if (addprime == true) cout << prime<< endl;
}
system ("pause");
return 0;
}


. Oh well, my guess of dutch was correct then =D.