数字求和
此题目来源于LZOI
题目传送门
#include <iostream> using namespace std; int main() { int n; cin >> n; int ones = n % 10; int tens = (n / 10) % 10; int hundreds = n / 100; int sum = ones + tens + hundreds; cout << sum << endl; return 0; }
此题目来源于LZOI
题目传送门
#include <iostream> using namespace std; int main() { int n; cin >> n; int ones = n % 10; int tens = (n / 10) % 10; int hundreds = n / 100; int sum = ones + tens + hundreds; cout << sum << endl; return 0; }