eolymp
bolt
Try our new interface for solving problems
Problems

The sum of digits

published at 10/21/21, 1:32:27 pm

help me guys plzzzzz it was a joke i am pro

published at 3/27/24, 8:03:41 pm

include <bits/stdc++.h>

using namespace std; int main() {

long n,sum=0; cin>>n; n=abs(n); while(n>0){ sum+=n%10; n = n/10; } cout<<sum<<endl; return 0; }

published at 4/1/24, 2:10:03 pm

include <iostream>

include <cmath>

using namespace std; int main(){ int n,a,cem=0; cin>>n; n=abs(n); while(n>0){ a=n%10; n=n/10; cem=cem+a;} cout<<cem;}

published at 4/14/24, 12:39:37 pm

include<iostream>

using namespace std; int main() { long long n,son,cem=0; cin>>n; while (n!=0) { son=n%10; if (son!=0) cem=cem+son; n/=10; } cout<<abs(cem); return 0; }