#include <iostream>
using namespace std;


int summa(int a){ //Нормальный способ с остатком от деления
   int x=0;
   while (a>0){
      x=x+a%10;//Добавляю к сумме остаток от деления на 10 (последнюю цифру числа)
      a=a/10; //Делю число на 10
   }
   return x;
}


int summa2(int a){//Вот тут "ручной" способ посчитать тот же самый остаток
   int x=0;
   while (a>0){
      x=x+a-(a/10)*10;
      a=a/10;
   }
   return x;
}



int main() {
   cout<<summa(123)<<endl;
   cout<<summa(79813)<<endl;
   cout<<"Sposob s deleniem\n";
   cout<<summa2(123)<<endl;
   cout<<summa2(79813)<<endl;
   return 0;
}
