Pagini recente » Cod sursa (job #2199715) | Cod sursa (job #2104871) | Cod sursa (job #2543956) | Cod sursa (job #620633) | Cod sursa (job #427946)
Cod sursa(job #427946)
#include<stdio.h>
#include<math.h>
long r,j,i,uc,s,n,f[30001];
int main()
{
freopen("cifra.in","r",stdin);
freopen("cifra.out","w",stdout);
scanf("%ld",&n);
for(i=1;i<=n;++i)
scanf("%ld",&f[i]);
for(i=1;i<=n;++i)
{
s=0;
for(j=1;j<=f[i];++j)
{
r=j%4;
uc=j%10;
if(r==0)
r=4;
s=s+pow(uc,r);
s=s%10;
}
printf("%ld\n",s);
}
return 0;
}