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