Cod sursa(job #613014)
| Utilizator | Data | 14 septembrie 2011 16:09:04 | |
|---|---|---|---|
| Problema | Cifra | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | test_info20 | Marime | 0.4 kb |
#include "stdafx.h"
#include <iostream>
using namespace std;
#include <conio.h>
#include <fstream>
int main()
{long int i,j,s,k,p,t,n;
ifstream f("cifra.in");
ofstream f1("cifra.out");
f>>t;
for(i=1;i<=t;i++){
f>>n; s=0;
for(j=1;j<=n;j++){p=1;
for(k=1;k<=j;k++){p=p*(j%10);p=p%10;}
s=s+p; s=s%10;
}
f1<<s <<endl;
}
f.close();
f1.close();
return 0;
}
