Sohila_Elshiref

Sum Digits

Jul 30th, 2021
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.19 KB | None | 0 0
  1. int n,sum=0;
  2.      cin>>n;
  3.      int arr[n];
  4.      for (int i=0;i<n;i++)
  5.      {
  6.          cin>>arr[i];
  7.      }
  8.      for (int j=0;j<n;j++)
  9.      {
  10.          sum=sum+arr[j];
  11.      }
  12.      cout<<sum;
Advertisement
Add Comment
Please, Sign In to add comment