#include<iostream>
#include<string>
using namespace std;
int main() {
int T;
while (cin >> T) {
for (int i = 0; i < T; i++) {
int number;
cin >> number;
string str;
str = to_string(number); //將輸入的數字轉成字串
int sum = 1;
for (string::iterator j = str.begin(); j != str.end(); j++) { //迭代器的使用,記得要先引入string
sum = (*j-48) * sum; //此時的j是ASCII碼的「數字」,所以要將其減48
}
cout << sum << endl;
}
}
return 0;
}
別問我為甚麼不直接輸入字串就好,因為我覺得將數字轉成字串比較帥:)