Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main(){
- int n;
- int s = 1;
- do{
- cout << "Input number ";
- cin >> n;
- } while ( n < 0 || n > 1.0e6);
- if (n >=15){
- cout << "Last three numbers: 000" << '\n';
- return 0;
- }
- if (n < 15 ){
- do{
- s = s*n;
- s=s%1000;
- n --;
- } while(n > 1);
- s=s%1000
- cout << "Last three numbers:" << s <<'\n';
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement