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
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;
}
0
Thanks very much ..MBZH31