Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1.  
  2. #include <iostream>
  3.  
  4. using namespace std;
  5.  
  6. int main(){
  7.  
  8. int n;
  9. int s = 1;
  10.  
  11. do{
  12. cout << "Input number ";
  13. cin >> n;
  14. } while ( n < 0 || n > 1.0e6);
  15.  
  16. if (n >=15){
  17. cout << "Last three numbers: 000" << '\n';
  18. return 0;
  19. }
  20. if (n < 15 ){
  21. do{
  22. s = s*n;
  23. s=s%1000;
  24. n --;
  25. } while(n > 1);
  26.  
  27. s=s%1000
  28.  
  29. cout << "Last three numbers:" << s <<'\n';
  30. }
  31.  
  32. return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement