Cod sursa(job #1185500)
Utilizator | Data | 15 mai 2014 21:12:00 | |
---|---|---|---|
Problema | Cifra | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.63 kb |
#include <iostream>
#include <fstream>
using namespace std;
int main()
{int p,k,i,s,n,x,j,g;
ifstream fin ("cifra.in");
ofstream fout ("cifra.out");
fin >> n;
for (i=1; i<=n; i++)
{
s = 0;
fin >> k;
x = 1;
for (p=1; p<=k; p++)
{
g = 1;
for (j=1; j<=p; j++)
{
g = g*x;
cout << "g: " << g << " ";
}
s = s + g%10;
s = s%10;
x++;
}
fout << s << endl;
}
return 0;
}