Cod sursa(job #2082480)

Utilizator swanheart82pop gheorghe swanheart82 Data 6 decembrie 2017 12:03:03
Problema Factorial Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.53 kb
#include <iostream>
#include <fstream>

using namespace std;

int main()
{ifstream f("fact.in");
ofstream g("fact.out");
unsigned long long p,n,i,x=1,k,j;
  f>>p;

  x=0;
  n=1;
  cout<<p;
  if (p==1)
    g<<n;
  while (x==0)
  {
      k=1;
      for (i=1;i<=n;i++)
        k=k*i;
        cout<<k<<endl;
        if (k%10==0)
        {j=0;
            while (k && k%10==0)
        {k=k/10;
        j++;

        }
        }
        if (j==p)
        {g<<n;
        }

      n++;
  }


    return 0;
}