topic
Homework time, sitting next Xiaopen friends ask you: "Five multiplied by seven equals how many?" You should be polite to enclose smiled and told him:. "Fifty-three" This question requires you, for any pair given positive integer, output their product backwards.
Input format:
Enter two given positive integer of not more than 1000 A and B in the first row, separated by a space therebetween.
Output format:
backwards product of the output of A and B in a row.
Sample input:
57
sample output:
53
Thinking
Output to modulo cycle.
Note that the results for the case of "01", leading zeros are not output here with a flag control, did not encounter characters have non-zero is false, that is not output to zero.
Code
#include <iostream>
using namespace std;
int main(){
int a, b;
cin >> a >> b;
a *= b;
bool flag = false;
while (a!=0){
int temp = a % 10;
if (temp==0){
if (flag){
cout << temp;
}
}
else{
cout << temp;
flag = true;
}
a /= 10;
}
cout << endl;
return 0;
}