(PCC)::[How-to-write-CPP-Program-to-Display-Factors-of-a-Number]::[cpp]
//Example: Display all Factors of a Number #include <iostream> using namespace std; int main() { int n, i; cout << "Enter a positive integer: "; cin >> n; cout << "Factors of " << n << " are: " << endl; for(i = 1; i <= n; ++i) { if(n % i == 0) cout << i << endl; } return 0; }