Home c c plus plus Divisor of a positive integer Divisor of a positive integer Author - thinhphamvn January 04, 2023 0 List all the "divisors" of the positive integer nSource Code>>> Download Source Code (Google Drive) #include int main() { int i, n; do { std::cout << "\nenter a positive integer n = "; std::cin >> n; if (n <= 0) { std::cout << "n must be a positive integer, please re-enter!"; } } while (n <= 0); i = 1; std::cout << "divisors of the positive integer " << n << ":\n"; while (i <= n) { if (n % i == 0) { std::cout << i << "\t"; } i++; } system("pause"); return 0; } Tags c c plus plus Facebook Twitter Whatsapp Newer Older