Click Here to go back to the homepage.

Last Factorial Digit Solution:


#include <stdio.h>

int main(){
    int arr[] = {1, 1, 2, 6, 4, 0, 0, 0, 0, 0, 0};
    int cases;
    int input;
    scanf("%d", &cases);
    for(int i = 0; i < cases; i++){
        scanf("%d", &input);
        printf("%d\n",arr[input]);
    }
    return 0;
}