fork download
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. int pot(double &a, double &b)
  6. {
  7. int l =0, tmp=0;
  8.  
  9. cin >> a >> b;
  10. if(a >=1 && b <=1000000000)
  11. {
  12. l = pow(a,b);
  13. tmp = l%10;
  14. }
  15.  
  16. return tmp;
  17. }
  18. int main()
  19. {
  20. int n;
  21. double a=0,b=0;
  22. cin>>n;
  23. if(n >= 1 && n<=10)
  24. {
  25. for(int i=0; i<n; ++i)
  26. {
  27. cout <<pot(a,b) << endl;
  28. }
  29. }
  30. return 0;
  31. }
Success #stdin #stdout 0s 3472KB
stdin
2
2 3
3 3
stdout
8
7