I need to make a program that prints all prime numbers between 3 and 100.
Here is my code so far. Right now it only outputs the number 3. What is wrong with it? Thanks for any help.
Code:#include<iostream> using namespace std; int main() {int num=3, checknum, remainder, answer=1; do{checknum=2; while(checknum<num-1) {remainder=num%checknum; if(remainder==0) {answer=0; continue;} else answer=1; checknum++; } if(answer=1) {cout<<""<<num;} num++; }while(num<101); return 0; }