**Prime numbers**. The problem I'm having is the algorithm is saying "Hey is this a prime number? Yea!" But then while it Checks to see if it is a prime number it actually stores the result giving me 0. I want to display back to the user all of the prime numbers from the Integer they entered. For exampel if they enter 36, I want to display the message, your prime factors are: 4, 9, 36

Check out my code

#include <iostream> #include <iomanip> using namespace std; //ALGORITHM TO FIND ALL THE FACTORS OF A # int main() { int num_1; int i; int counter = 0; cout<<"Enter Number to be factored:"; cin>> num_1; for(i = 2; i <= num_1; i++) { if(num_1 % i == 0) { cout << "-----FACTORS OF YOUR #-------" << endl; cout << setw(5) << i; counter ++; //INCREASE COUNTER EVERY TIME LOOP EXECUTES bool prime = true; for (i = 2; i < num_1; ++i) { if (num % i == 0) { //HERE I WANT TO SAY THE PRIME NUMBERS OF YOUR INPUT ARE: AND HAVE THEM LISTED. } } if(counter == 4) { cout << endl; //IF COUNTER EQUALS 4 OUTPUT END LINE counter = 0; //RESET COUNTER TO 0 AFTER COUNTER REACHES 4 } } } }