fork(1) download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. int n, a ,b, wynik;
  5. long int potega(int a, int b)
  6. {
  7. wynik=1;
  8. while (b>0)
  9. {
  10. wynik=wynik*a;
  11. b--;
  12. } return wynik;
  13. }
  14. int main()
  15. {
  16. cin>>n;
  17. for(int i=1; i<=n; i++)
  18. {
  19. cin>>a>>b;
  20. cout<<potega(a,b)%10<<endl;
  21. }
  22. return 0;
  23. }
  24.  
Success #stdin #stdout 0s 3468KB
stdin
Standard input is empty
stdout
Standard output is empty