View Code of Problem 3696

#include<iostream>
#include<cstdio>

using namespace std;

int main()
{
	int num[10][4]={{0,0,0,0},
					{1,1,1,1},
					{6,2,4,8},
					{1,3,9,7},
					{6,4,6,4},
					{5,5,5,5},
					{6,6,6,6},
					{1,7,9,3},
					{6,8,4,2},
					{1,9,1,9}
					};
	int n;
	while(scanf("%d", &n) != EOF)
	if(n == 0)
		printf("1\n");
	else
		printf("%d\n", num[n%10][n%4]);
	return 0;
}

Double click to view unformatted code.


Back to problem 3696