Advertisement
Guest User

Untitled

a guest
May 24th, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. bool b=true;
  4. int sum, a;
  5. int main() {
  6.  
  7.     ifstream we;
  8.     we.open("liczby.txt");
  9.  
  10.      for (int i=0; i<500; ++i) {
  11.         we >> a;
  12.         int r = a;
  13.         while (b) {
  14.             if (a < 10) b=false;
  15.             int x = a%10;
  16.             int sil;
  17.             for (int j=1; j<= x; ++j) {
  18.                 sil = sil * j;
  19.             }
  20.             sum += sil;
  21.             a /= 10;
  22.         }
  23.         if (sum == r) cout << r;
  24.      }
  25.  
  26.     we.close();
  27.  
  28.  
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement