//Dev-C++ 5.11
#include
int main(void)
{long long int i,curr;
int currsum,flag;
long long sum=0;
for(i=8;i<=1111111;i++)<br> {curr=i;
flag=0;
currsum=0;
while (curr!=0 && flag==0)
{if (curr%10==0)
flag=1;
else
{currsum+=curr%10;
curr/=10;}}
if(flag==0 && currsum==7)
sum+=i;}
printf("%d",sum);
return 0;}
Вывод:
2165220