Advertisement
STANAANDREY

facto

Jan 17th, 2019
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.33 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main ()
  6. {
  7.    unsigned n,k=1,x,p,ok=0;
  8.  
  9.   cout<<"n=";cin>>n;
  10.  
  11.   while (k<n&&!ok)
  12.   {
  13.       p=1;
  14.       for (x=1;x<=k;x++)
  15.           p*=x;
  16.  
  17.       if (p==n)
  18.         ok=1;
  19.       else
  20.       k++;
  21.   }
  22.  
  23.   if (ok)
  24.     cout<<"DA"<<endl<<k;
  25.   else
  26.     cout<<"NU";
  27.  
  28.     return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement