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