Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include<bits/stdc++.h>
- #define ll long long
- using namespace std;
- void sum( long long a ){
- long long s = 0;
- while(a>0){
- s= s+(a%10);
- a/=10;
- }
- cout<<s;
- }
- int main() {
- ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
- long long n,a; cin>>n>>a;
- sum(a);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement