Skip to content

Instantly share code, notes, and snippets.

@pinglunliao
Last active November 5, 2019 08:45
Show Gist options
  • Save pinglunliao/0a9fb57328124859dbfd to your computer and use it in GitHub Desktop.
Save pinglunliao/0a9fb57328124859dbfd to your computer and use it in GitHub Desktop.
#include <cmath>
#include <cstdio>
using namespace std;
int main(void){
int num = 0;
int n = 0;
long result = 1;
while(scanf("%d", &num) != EOF)
{
for(int i = 1; i <= num; i++)
{
result = 1;
scanf("%d", &n);
while(n / 10 > 0)
{
int r = n % 10;
result *= r;
n = n / 10;
}
result *= n;
printf("%ld\n", result);
}
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment