0

I have problem in this code please help me..

I wanted to write code that test if the input number can div on the sum of his numbers or not..please help me https://code.sololearn.com/cSzF0EiuThy4/?ref=app

6th Dec 2018, 8:49 PM
Elias Dayoub
Elias Dayoub - avatar
2 Answers
+ 2
#include <iostream> using namespace std; int main() { int x, y=0,mod=0,div=10; cin>>x; y=x; while (x > 0) { mod+=x%div; x/=div; } if (y%mod==0) cout<<"yes"; else cout<<"No"; return 0; }
6th Dec 2018, 9:04 PM
MBZH31
MBZH31 - avatar
0
Thanks very much ..MBZH31
7th Dec 2018, 10:29 AM
Elias Dayoub
Elias Dayoub - avatar