#include <stdio.h> #include <math.h> using namespace std; int main(){ int N; long long int a; while( ~scanf("%d", &N )){ a = 1; for( int i=0; i<N; i++ ){ a *= N; } printf("%d\n", a%10 ); } return 0; }
Double click to view unformatted code.