Im trying to create a program that lists all prime numbers within a range of two number. Can someone please let me know why the below program isn't working?
using namespace std;
cout <<"Input highrange here: ";
cin >> high_range;
cout <<"Input lowrange here: ";
cin >> low_range;
for(w=low_range; w>=high_range; w++)
if(w%2!=0 && w%3!=0 && w%4!=0 && w%5!=0 && w%6!=0 && w%7!=0 && w%8!=0 && w%9!=0)
cout << w;
w>=high_range; w++) should be
you are correct. thanks for your help.
But I think your code does not work properly. You need to implement a function that checks first whether the number is prime or not then print it out.