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