Cod sursa(job #1942484)

Utilizator Teodor97Teodor Toma Teodor97 Data 28 martie 2017 00:16:13
Problema Cifra Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.37 kb
#include <iostream>
#include <fstream>
#include <math.h>

using namespace std;

ifstream fin("cifra.in");
ofstream fout("cifra.out");

int main()
{
    int t,i,j,n,s,k,l;
    fin>>t;
    for(i=1;i<=t;i++)
    {
     fin>>n;
     s=0;
     for(j=1;j<=n;j++)
     {
     l=j;
     for(k=2;k<=j;k++)
      l=l*j;
     s=(s+l)%10;
     }
     fout<<s<<endl;
    }
    return 0;
}