Can i optimize this code?

#include
using namespace std;

int main(){

int n,sum=0;

while(sum>=0)
{


	cin>>n;
	sum+=n;
	if(sum>=0)
	{
		cout<<n<<endl;
	}
	else
	{
		break;
	}
}











return 0;

}

Hey @ashishxmathew
no this it the best solution.

If u dont have any other doubt in this then please mark it as resolved :slight_smile: