Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<cmath>
- using namespace std;
- int Stepenuj(int broj, int stepen) {
- return pow(broj, stepen);
- }
- int VratiZadnjuCifru(int broj) {
- return broj % 10;
- }
- int main() {
- int a, b, n;
- cin>> n;
- for (int i=0; i<n; i++)
- {cin >> a >> b;
- if (((a==0) && (b==0)) || (b==0))
- cout<<1<<endl;
- else if (a==0)
- cout<<0<<endl;
- else
- cout<<VratiZadnjuCifru(Stepenuj(a, b))<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement