Spitballing something that should with integers, but it won't take arbitrarily large numbers. Also kinda untested...
void unsigned int LastDigitPower(unsigned long long int a, unsigned long long int b) { unsigned int last = static_cast<unsigned long long int>(0xf) & pow(a, b); if(last >= 8) { last &= 0x9; } return last; }
Maybe there's a way to eliminate the if, but right now I'm not really sure ¯\_(ツ)_/¯
Technically doesn't pass I suppose but I wanted to do something that works with numbers first.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Spitballing something that should with integers, but it won't take arbitrarily large numbers. Also kinda untested...
Maybe there's a way to eliminate the if, but right now I'm not really sure ¯\_(ツ)_/¯
Technically doesn't pass I suppose but I wanted to do something that works with numbers first.