Input numbers from the user and find the sum of all those input numbers until the user
inputs zero. In other means, the loop should end when the user enters 0. Finally, display the
sum of all those numbers entered by the user.
#include <iostream>
using namespace std;
int main(){
int number;
int sum=0;
do{
cout<<"Ente the number (0 - exit): ";
cin>>number;
sum+=number;
}while(number!=0);
cout<<"\nSum of all numbers entered by the user: "<<sum<<"\n\n";
system("pause");
return 0;
}
Comments
Leave a comment