Test 1 and 2 not passed and why showing this msg after submit code. (Note: You were not awarded any points for this solution because you have unlocked the editorial to this problem.)
cuz i don’t unlocked editorial…
Test 1 and 2 not passed and why showing this msg after submit code.N
hi @dheerajjha11111_bb855e8d7a52ef0d,
your logic is incorrect refer
#include<iostream>
using namespace std;
int main(){
int i,no,sum=0;
for(i=1;;i++){
cin>>no;
sum=sum+no; // add to sum
if(sum>=0){ // print no if sum >= 0
cout<<no<<endl;}
else{
break; // otherwise break
}
}
return 0;
}
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.