hello everyone.
the is a real pain in the neck...can anyone help me write a program that determines all the preimes from 1 to 1000 , counts them, and determine if any of the primes are carmuichael numbers...i donot know what the hell they are !!
HELP !!!!
i got this program from a friend but it only calculates the primes up to 100, how do i extend it to 1000 ??
#include <iostream.h>
void main(){
//declarations
int var1;
int var2;
int flag;
//tells that the user will see all the prime numbers up too 100
cout << "All of the prime numbers up to 100 are...\n";
//calculations
for(var1 = 2; var1 <= 100; var1++){
flag = 1;
for(var2 = 2; var2 < var1; var2++){
if((int)var1 % (int)var2 == 0){
flag = 0;
}
}
//output...
if(flag == 1){
cout << var2;
cout << " ";
}
}
cout << " ";
}