Cod sursa(job #858963)

Utilizator Iulia_ivanaIulia Ivana Iulia_ivana Data 19 ianuarie 2013 16:11:40
Problema Factorial Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.37 kb
#include<cstdio>
#include<math.h>
using namespace std;

int main()
{
    int n=1,p,y=1,cnt2=1;
    freopen("fact.in","r",stdin);
    freopen("fact.out","w",stdout);
    scanf("%d",&p);
    while(y!=0)
    {
        n=n*cnt2;
        cnt2++;
        if(n>pow(10,p))
            if(n%(pow(10,p))==0 && n%(pow(10,p+1))!=0)
                y=0;
    }
    return 0;
}