SHARE
TWEET

Untitled

a guest Oct 21st, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <fstream>
  3. #include <vector>
  4. #include <cmath>
  5.  
  6. using namespace std;
  7.  
  8. int silnia (long long int n)
  9. {
  10. long long int k, s;
  11.     if (n>1)
  12.     {
  13.         for (k=2, s=1; k<=n; k++)
  14.             s=s*k;
  15.         }
  16.         else
  17.             s=1;
  18.  
  19.  
  20. }
  21. int main()
  22. {
  23.     ifstream dane ("przyklad.txt");
  24.     long long int x, y, k, s;
  25.  
  26.     while (dane >> x)
  27. {   y=x;
  28.     s=0;
  29.     while (x>0)
  30.     {   k=0;
  31.         k=x%10;
  32.         s=s+silnia(k);
  33.         x=x/10;
  34.     }
  35.     if (y==s)
  36.         cout << y << endl;
  37. }
  38.     return 0;
  39.  
  40. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top