Advertisement
Guest User

Untitled

a guest
Oct 26th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. #include<iostream>
  2. #include<cmath>
  3. using namespace std;
  4.  
  5. int Stepenuj(int broj, int stepen) {
  6. return pow(broj, stepen);
  7. }
  8.  
  9. int VratiZadnjuCifru(int broj) {
  10. return broj % 10;
  11. }
  12.  
  13. int main() {
  14. int a, b, n;
  15. cin>> n;
  16. for (int i=0; i<n; i++)
  17. {cin >> a >> b;
  18. if (((a==0) && (b==0)) || (b==0))
  19. cout<<1<<endl;
  20. else if (a==0)
  21. cout<<0<<endl;
  22. else
  23. cout<<VratiZadnjuCifru(Stepenuj(a, b))<<endl;
  24. }
  25. return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement