[Solved] Sum of 10 number until 0 is keyed in [C++]


i wrote something, you can compile it online http://cpp.sh/6u447

#include <iostream>

int main()
{
  int arr[10] = { 0 };
  for(int i=0;i<10;i++){
      int temp ;
      std::cin>>temp;
      if(temp == 0){
        break;   
      }
      arr[i] = temp; 
  }
  int sum =0;
  for(int j=0;j<10;j++){
      sum+=arr[j];
  }
  std::cout<<"sum is "<<sum;
}

5

solved Sum of 10 number until 0 is keyed in [C++]