Cod sursa(job #669015)
Utilizator | Data | 25 ianuarie 2012 22:46:55 | |
---|---|---|---|
Problema | Cifra | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.28 kb |
#include<iostream>
#include<fstream>
using namespace std;
int main()
{int n,y=1,s=0,z,p;
ifstream f1("cifra.in");
ofstream f2("cifra.out");
f1>>n;
while(y<=n)
{z=y;p=1;
while(z!=0)
{p=p*y;
z--;}
s=s+p;
y++;
f2<<s%10;
f2<<endl;
f1>>n;}
f1.close();
f2.close();
return 0;}