Вот что У меня получилось:
Код: Выделить всё
#include
using namespace std;
int main() {
long num = 123456789;
long sum = 0;
long temp = 0;
while (num>0)
{
temp = 2*(num/10%10); // every other digit multiplied by 2
num /= 100;
//cout
Подробнее здесь: [url]https://stackoverflow.com/questions/78561148/why-does-the-loop-skip-by-2-starting-from-last-digit[/url]