Advertisement
sherry_ahmos

Untitled

Dec 18th, 2021
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.25 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     long long n;
  8.     cin>>n;
  9.     long long arr[n],sum=0;
  10.     long long x;
  11.     cin>>x;
  12.     for(long long i=n-1;i>=0;i--){
  13.         arr[i]=x%10;
  14.         x=x/10;
  15.         sum+=arr[i];
  16.     }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement