Submission

Status:

PPPPPPPPPP

Score: 100

User: Cmoss9

Problemset: เลขหลักของผลคูณ

Language: c

Time: 0.001 second

Submitted On: 2024-10-16 21:32:16

#include <stdio.h>
int main () {
    long long a,b,multi;
    scanf("%lld %lld",&a,&b);
    int digit;
    scanf("%d",&digit);
    multi = a*b;
    long long temp = multi;
    int count = 0;
    while (temp>0) {
        temp/=10;
        count++;
    }
    long long arr[count];
    for (int i = 0;i<count;i++) {
        arr[i] = multi%10;
        multi /= 10;
    }
    long long reverse[count];
    for (int i = 0;i<count;i++) {
        reverse[i] = arr[count-i-1];
    }
    if (digit>count) {
        printf("_");
        return 0;
    }
    printf("%d",reverse[digit-1]);
}