Hey everybody I'm fairly new to C++ and have been understanding until Ive hit this rock. Im trying to figure out how to indicate whether or not a first command line argument interpreted as an integer is a multiple of the sum of its own digits. I understand that logic as if you type 20 = 2(2+0) where 2 is a multiple and 3113 = 8 which is not a multiple but i feel hopeless trying to set it up. Any tips, hints or help i would love so much. Thanks anyone for a comment in advance. And here is my code.
Code:
#include <iostream>
using namespace std;
int main(int argc, char*argv[])
{
int num, rem, sum = 0;
cout << "Enter a number :"<<endl;
cin >> num;
while(num!=0)
{
rem=num%10;
num=num/10;
sum=sum+rem;
}
cout << sum << endl;
return 0;
}