#include<iostream> using namespace std; #include<cmath> int main() { int n; while(cin>>n) { cout<<(int)pow(n,n)%10<<endl; } }
Double click to view unformatted code.