Advertisement
Guest User

Untitled

a guest
Nov 9th, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. #include<iostream>
  2. #include<cmath>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int D, a, b, potega, cyfra_jednosci;
  8. cin >> D;
  9. if (D >= 1 && D <= 10)
  10. {
  11. for (int i = 0; i < 10;i++)
  12. {
  13. cin >> a;
  14. cin >> b;
  15. if ((a >= 1 && a <= 1000000000) && (b >= 1 && b <= 1000000000))
  16. {
  17. potega = pow(a, b);
  18. cyfra_jednosci = potega % 10;
  19. }
  20. else
  21. {
  22. exit(0);
  23. }
  24. cout << cyfra_jednosci << endl;
  25. }
  26. }
  27. else
  28. {
  29. exit(0);
  30. }
  31. system("PAUSE");
  32. return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement