题解 | #数字之和#
数字之和
http://www.nowcoder.com/practice/ae759916631f4711a90c4d4d9657f4b0
#include using namespace std;
void sum(int n){ int sum =0; while(n){ sum+=n%10; n/=10; } cout<<sum<<" "; }
int main(){ int n; while(cin>>n){ int m=n*n; sum(n); sum(m); cout<<endl; } }