I did all the coding, and I think that it is correct, but I dont understand why the program does not output the prime numbers!!!
#include<iostream>
using namespace std;
int main()
{
double newn;
char ans;
do
{
cout << "This is a program that will help you find all the prime numbers between 3 and 100.\n";
cout << "This numbers are: \n";
for (int n = 3; n <= 100; n++)
{
for (int i = 2; n < i; ++i)
{
newn = n % i;
while(newn > 0)
{
cout << n << " ";
}
}
}
cout << endl;
cout << "Do you want to run this program again? Press 'Y' for yes, or 'N' for no\n";
cin >> ans;
} while (ans == 'Y' || ans == 'y');
cout << "Have a nice day!\n";
return 0;
}
What did I do wrong??? When I compile it and run it, this is what it says:
This is a program that will help you find all the prime numbers between 3 and 100.
This numbers are:
Do you want to run this program again? Press 'Y' for yes, or 'N' for no
And it does not output any number!!! Help PLZ!!