Advertisement
Guest User

Untitled

a guest
Sep 25th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int n;
  8. cin >> n;
  9. long long m = 1;
  10. for (int i = 1; i <= n; i++)
  11. {
  12. m *= i;
  13. while (m % 10 == 0)
  14. {
  15. m /= 10;
  16. }
  17. }
  18. cout << m % 10;
  19. cin.get();
  20. cin.get();
  21. return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement