Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as C++ by ЫЫ ( 16 years ago )
#include <iostream>
#include <string>
using namespace std;
int Sum_of_Digit(int n, int sum)
{
while (n!=0)
{
sum += n;
n /= 10;
}
return sum;
}
int main(int argc, char* argv[])
{
int n;
int sum=0;
int t=0;
cout << "Input a number = "; // Ââîäèì ÷èñëî
cin >> n;
cout<<"Sum = "<<Sum_of_Digit(n,sum)<<'\n'; // Âû÷èñëÿåì ñóììó öèôð ââåäåíîãî ÷èñëà
t = n - Sum_of_Digit(n,sum);
cout<<"n - Sum ="<<t<<'\n';
if ((t%9==0) && (t!=0) )
cout<<"Can divide"<<'\n';
else
cout<<"Can not divide"<<'\n';
system("PAUSE");
return 0;
}
Revise this Paste