Quick actions

cmd+k|ctrl+k

Navigation

Languages

各位数字积 cpp

Snippet info

Language

Cpp

Visibility

public

Author

kuresaru

Created

2022-12-05T09:20:30.051184Z

Updated

2022-12-05T09:29:37.668408Z

#include <iostream>
#include <cmath>
using namespace std;

int p(int n)
{
    int r = 1;
    while (n > 0)
    {
        r *= n % 10;
        n /= 10;
    }
    return r;
}

int main() {
    int r;
    cout << "输入一个数字";
    cout << endl;
    cin >> r;
    cout << endl;
    r = p(r);
    cout << r;
    cout << endl;
    return 0;
}
INFO