Cod sursa(job #2168376)
| Utilizator | Data | 14 martie 2018 10:38:08 | |
|---|---|---|---|
| Problema | Cifra | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.52 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin ("cifra.in");
ofstream fout ("cifra.out");
int n,numar,exponent,putere,suma;
int main()
{
fin>>n;
while(n)
{
fin>>numar;
exponent=numar-1;
putere=numar;
while(exponent>0)
{
if(numar>10) numar%=10;
numar*=putere;
exponent--;
}
suma+=numar%10;
if(suma>10) suma%=10;
fout<<suma<<"\n";
n--;
}
return 0;
}
