Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- bool b=true;
- int sum, a;
- int main() {
- ifstream we;
- we.open("liczby.txt");
- for (int i=0; i<500; ++i) {
- we >> a;
- int r = a;
- while (b) {
- if (a < 10) b=false;
- int x = a%10;
- int sil;
- for (int j=1; j<= x; ++j) {
- sil = sil * j;
- }
- sum += sil;
- a /= 10;
- }
- if (sum == r) cout << r;
- }
- we.close();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement