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