TDM-GCC 4.9.2 64-bit Release
#include
#include
#include
int main(int argc, char *argv[])
{
system("chcp 1251 >nul");
setlocale(LC_ALL, "Russian");
int n;
scanf("%d",&n);
int mas[n], sum = 0, temp = 0;
for(int i = 0; i < n; i++)
{
scanf("%d",&mas[i]);
temp = abs(mas[i]);
while(temp >= 10)
{
sum += temp % 10;
temp /= 10;
}
sum += temp;
}
printf("%d",sum);
return EXIT_SUCCESS;
}