Cod sursa(job #2124864)
| Utilizator | Data | 7 februarie 2018 17:55:42 | |
|---|---|---|---|
| Problema | Cifra | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.54 kb |
#include <iostream>
#include <fstream>
using namespace std;
int numar_numere, s=0;
int numar (int n)
{
int xx;
xx=n;
if (n != 1)
for (int i = 1; i < n; i++)
xx*=n;
return xx;
}
int main()
{
ifstream fin ("cifra.in");
ofstream fout ("cifra.out");
fin>>numar_numere;
for (int i = 1; i <= numar_numere; i++)
{
int x;
fin>>x;
s=0;
for (int j = 1; j <= x; j++)
s+=numar(j);
fout<<s%10 <<"\n";
}
return 0;
}
