Advertisement
semsem_elazazy

https://codeforces.com/group/n3sTiYtHxI/contest/348734/problem/S

Feb 22nd, 2022
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.35 KB | None | 0 0
  1. #include <iostream>
  2. #include<bits/stdc++.h>
  3. #define ll long long
  4. using namespace std;
  5.  
  6. void  sum( long long a ){
  7.   long long s = 0;
  8.  while(a>0){
  9.      s= s+(a%10);
  10.      a/=10;
  11.  }
  12.  cout<<s;
  13.  }
  14.  
  15. int main() {
  16.    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
  17.  
  18. long long n,a; cin>>n>>a;
  19.  sum(a);
  20.  
  21.     return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement