Advertisement
EstEsca

Untitled

Apr 28th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. #include <iostream>
  2. using namespace TMath;
  3.  
  4. int quiz2(){
  5. long x;
  6. cout << "we will determine the number of trailing zeros at the end of X! enter the number X" << endl;
  7.  
  8. cin >> x;
  9.  
  10.  
  11. int p;
  12.  
  13. for(int i=1; i<=x; i++){
  14. cout << "i = " << i << endl;
  15.  
  16. int ans;
  17.  
  18.  
  19. if (i%5==0){
  20. cout << "5n is detected" << endl;
  21. for(p=1;p<=i;p++){
  22.  
  23. cout << "p =" << p << endl;
  24.  
  25. int a=Power(5,p);
  26.  
  27. cout << "a =" << a << endl;
  28. if (i/a==0)
  29. {ans=p-1;
  30. break;}
  31. }
  32. cout << ans;
  33.  
  34. }
  35. }
  36. int total;
  37. total = total+ans;
  38. cout << "total = " << total;
  39. return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement