Pagini recente » Cod sursa (job #2750048) | Cod sursa (job #394671) | Cod sursa (job #2464736) | Cod sursa (job #415658) | Cod sursa (job #154593)
Cod sursa(job #154593)
#include<stdio.h>
long long n;
int t,v[]={0,1,4,7,6,5,6,3,6,9};
FILE *g=fopen("cifra.out","w");
void solve (long long a)
{
long long s=0,i;
for (i=1;i<=a;++i)
s+=v[i%10];
fprintf(g,"%lld\n",s%10);
}
void citire ()
{
int i;
long long a;
FILE *f;
f=fopen("cifra.in","r");
fscanf(f,"%d",&t);
for (i=1;i<=t;++i)
{
fscanf(f,"%ld",&n);
a=n;
solve (a);
}
fclose(f);
}
int main ()
{
citire ();
return 0;
}