T
triplejump24
Hey. Im trying to make program that basically displays all the prime
numbers. I need to use bool and for but im not quite sure if i have this
right. So far i have this bunch of a mess but can anyone point me in the
right direction? Thanks!
# include <iostream>
# include <cmath>
using namespace std;
int i;
//int sqrt;
//int j;
int x;
int j;
int limit;
bool primeNumber(int);
int main() {
// cout << "Limit: ";
// cin >> x;
// if ((x % 2 == 0) & (x % x == 0))
// {
// return true;
// }
// else
// {
// return false;
// return 0;
//}
//
//bool primeNumber; {
// if ((x % 2 == 0) & (x % x == 0))
// {
// return true;
// }
// else
// {
// return false;
// }
//}
for (i = 2; i <= x; i++)
cout << i;
{
for (j = 2; j <= sqrt(i); i++)
cout << sqrt(100.0) << endl;
cout << sqrt(static_cast<double>(100)) << endl; //static cast conversts
from one type to another
}
return 0;
}
numbers. I need to use bool and for but im not quite sure if i have this
right. So far i have this bunch of a mess but can anyone point me in the
right direction? Thanks!
# include <iostream>
# include <cmath>
using namespace std;
int i;
//int sqrt;
//int j;
int x;
int j;
int limit;
bool primeNumber(int);
int main() {
// cout << "Limit: ";
// cin >> x;
// if ((x % 2 == 0) & (x % x == 0))
// {
// return true;
// }
// else
// {
// return false;
// return 0;
//}
//
//bool primeNumber; {
// if ((x % 2 == 0) & (x % x == 0))
// {
// return true;
// }
// else
// {
// return false;
// }
//}
for (i = 2; i <= x; i++)
cout << i;
{
for (j = 2; j <= sqrt(i); i++)
cout << sqrt(100.0) << endl;
cout << sqrt(static_cast<double>(100)) << endl; //static cast conversts
from one type to another
}
return 0;
}