Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: theem1502
Problemset: เลขหลักของผลคูณ
Language: c
Time: 0.001 second
Submitted On: 2025-09-12 14:32:39
#include <stdio.h>
int main() {
int digit;
long long a, b;
scanf("%lld %lld %d", &a, &b, &digit);
long long prod = a * b;
long long tempprod = prod;
int digitcount = 0;
if (tempprod == 0) {
digitcount = 1;
}
while (tempprod > 0) {
tempprod /=10;
digitcount++;
}
if (digit == 0) {
printf("%c", '_');
return 0;
}
if (digit > digitcount) {
printf("%c", '_');
return 0;
}
for (int i = 0; i < digitcount - digit; i++) {
prod /= 10;
}
printf("%d", prod % 10);
}