Cod sursa(job #473748)
Utilizator | Data | 31 iulie 2010 19:15:33 | |
---|---|---|---|
Problema | Factorial | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.54 kb |
#include <fstream>
#include <iostream>
#include <stdio.h>
using namespace std;
ifstream f("fact.txt");
ofstream g("fact.out");
int main()
{
int p,x = 0,y = 0,z;
f >> p;
for (int i = 1 ; i < 20 ; i++ )
{
z = i;
while ( z % 2 == 0 )
{
x++;
z = z / 2;
}
z = i;
while ( z % 5 == 0 )
{
y++;
z = z / 5;
}
if ((x < y) && (x == p ))
{
g << i ;
break;
}
if ((x > y) && (y == p ))
{
g << i ;
break;
}
}
return 0;
}