合肥工业大学oj 1240 幸运数字

#include<iostream>
using namespace std;

int n, count;
int main(){
    while(cin >> n){
    	count = 0;
        int num = n;
        int count = 0;
        while(num != 0){
            count += (num % 10);
            num /= 10;
        }
        
        cout << ((n % count == 0) ? "yes" : "no") << endl;
    }
    
    return 0;
}

//presented by 大吉大利,今晚AC

猜你喜欢

转载自blog.csdn.net/lalala_HFUT/article/details/87967363