Cod sursa(job #1609940)
| Utilizator | Data | 23 februarie 2016 10:22:00 | |
|---|---|---|---|
| Problema | Cifra | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.46 kb |
#include <iostream>
#include <stdio.h>
#include <cmath>
using namespace std;
FILE *f,*g;
int main()
{
int n,i,s,c,j;
f=fopen("cifra.in","r");
g=fopen("cifra.out","w");
fscanf(f,"%d",&n);
for(i=1;i<=n;i++)
{
s=0;
fscanf(f,"%d",&c);
for(j=1;j<=c;j++)
{
s=s+pow(j,j);
s=s%10;
}
fprintf(g,"%d\n",s);
}
fclose(f);
fclose(g);
return 0;
}
