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