7-7 I won't tell you (15 points) When you are doing your
homework, the little friend next to you asks you: "What is five times seven?" You should smile and tell him politely: "Fifty-three ." This question asks you to, for any pair of given positive integers, print their product backwards.
Input format:
Input gives two positive integers A and B up to 1000 on the first line, separated by spaces.
Output format:
Print the product of A and B backwards in one line.
Input sample:
5 7
Sample output:
53
#include <iostream>
using namespace std;
int main()
{
int q[100], a, b, t = 0, flag = 1;
cin>>a>>b;
int tmp = a*b;
while(tmp)
{
q[t++] = tmp%10;
tmp /= 10;
}
for(int i = 0;i < t;i++)
{
if(q[i] == 0 && flag) continue; //注意去除前导零
else flag = 0;
cout<<q[i];
}
return 0;
}