Submission #3651056

#include
using namespace std;
int main()
{
int sum=0,i,j;
while(sum>=0)
{

	cin>>i;
	sum=sum+i;
  j=i;

}
cout<<“cumulative sum is”<<sum<<endl;
cout<<“Sorry! Now cumulative of given nos truned in to negative no”<<endl;
cout<<j<<" “<<” is the last no that truned the sum to negative";
return 0;
}

@ANCODE Please mention what problem you are facing. Also please save your code on ide.codingblocks.com and then share its link.

https://online.codingblocks.com/app/player/44267/content/19258/4693

Don’t know.It running well offline IDE

Showing 4 cases fail

Input is 1 2 3 4

output

cumulative sum is-2147483646
Sorry! Now cumulative of given nos truned in to negative no
4 is the last no that truned the sum to negative

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.