Cod sursa(job #1502274)

Utilizator OFY4Ahmed Hamza Aydin OFY4 Data 14 octombrie 2015 15:04:55
Problema Factorial Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.41 kb
#include<fstream>
using namespace std;
int main(){

    ifstream fin("fact.in");
    ofstream fout("fact.out");

    int n=0,p,i=1,temp;

    fin>>p;

    if(p==0){

        fout<<i;
    }
    else{

        do{

            n=n+5;temp=n;

            do{
                temp=temp/5;

                --p;

            }while(temp%5==0);
        }while(p>0);

        fout<<n;
    }
}