#include #include int func1(long testee, long tester); void func2(long testee); void main() { long number, choice; do{ cout << "Input number to be factored -->"; cin >> number; func2(number); cout << "\nEnd of program. Would you like to run it again?\n(1) yes (2) no\n:"; cin >> choice; }while(choice == 1); } int func1(long testee, long tester) { long answer; answer = testee%tester; if(answer == 0) return 1; else if(answer != 0) return 0; } void func2(long testee) { long working, tester, valid, repeat; working = testee; if(testee <= 1) { cout << "\nThis is negative, 0 or 1, or otherwise invalid. So, why did you enter it? Sigh.\n"; return; } else if(testee > 1) { tester = 2; repeat = 1; while(repeat == 1) { valid = func1(working, tester); if(valid == 1) { cout << tester << endl; working = working/tester; } else if(valid == 0) { tester++; if(tester >= testee) repeat = 0; } if(working == 1) return; } if(testee == working) { cout << testee << " is prime.\n"; } return; } }