Cod sursa(job #507300)
| Utilizator | Data | 5 decembrie 2010 18:51:26 | |
|---|---|---|---|
| Problema | Cifra | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.58 kb |
#include <fstream>
#include <iostream>
using namespace std;
int main()
{
int n, nr, ucif=0, suma=1, i, j, k;
ifstream fin("cifra.in");
ofstream fout("cifra.out");
fin >> n;
for(i=1;i<=n;i++)
{
fin >> nr;
for(j=1;j<=nr;j++)
{
for(k=1;k<=j;k++)
{
suma = suma * j % 10;
}
ucif = ucif + suma % 10;
suma = 1;
}
ucif = ucif % 10;
fout << ucif << endl;
ucif = 0;
}
fin.close();
fout.close();
return 0;
}
