Cod sursa(job #1124664)

Utilizator Viorell008Iordache Viorel Viorell008 Data 26 februarie 2014 13:07:00
Problema Cifra Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.38 kb
#include<iostream>
#include<fstream>
using namespace std;
ifstream x("cifra.in");
ofstream y("cifra.out");
int main ()
{
    int i,nr,n,s,c,j;
    x>>n;
    for(i=1;i<=n;i++)
    {
        x>>nr;
        s=0;
        for(j=1;j<=nr;j++)
        {
            s=s+j*j;
        }
        c=s%10;
        y<<c<<endl;
    }
    x.close();
    y.close();
    return 0;
}