📜  c+ 中的 20 因子 - C++ 代码示例

📅  最后修改于: 2022-03-11 14:44:54.274000             🧑  作者: Mango

代码示例1
#include 
using namespace std;

int main() {
    int n, i;

    cout << "Enter a positive integer: ";
    cin >> n;

    cout << "Factors of " << n << " are: ";  
    for(i = 1; i <= n; ++i) {
        if(n % i == 0)
            cout << i << " ";
    }

    return 0;
}