#include <iostream> using namespace std; int n; char check (int r); /* * */ int main(int argc, char** argv) { int r1 = 0, r2, r3; cout << "Below will be printed the Proper Divisors" << endl; sleep(5); for (n = 20; n >= 20 && n <=30; n++) { cout << "Integer " << n << ":"; for (int d = 1; d < n; d++) { if (n % d == 0) { r1 = r1 + d; cout << d << ", "; } } cout << " = " << r1 << ". It is " << check(r1) << endl; r1 = 0; } return 0; } char check (int r) { if (r < n){ cout << "Deficient"; } else if (r == n) { cout << "Perfect"; } else { cout << "Abundant"; } }
Standard input is empty
Below will be printed the Proper Divisors Integer 20:1, 2, 4, 5, 10, Abundant = 22. It is @ Integer 21:1, 3, 7, Deficient = 11. It is @ Integer 22:1, 2, 11, Deficient = 14. It is @ Integer 23:1, Deficient = 1. It is @ Integer 24:1, 2, 3, 4, 6, 8, 12, Abundant = 36. It is @ Integer 25:1, 5, Deficient = 6. It is @ Integer 26:1, 2, 13, Deficient = 16. It is @ Integer 27:1, 3, 9, Deficient = 13. It is @ Integer 28:1, 2, 4, 7, 14, Perfect = 28. It is @ Integer 29:1, Deficient = 1. It is @ Integer 30:1, 2, 3, 5, 6, 10, 15, Abundant = 42. It is @