Issue of compiler

i have written a code on the compiler provided by you. i checked this code on other compiler it is correct.but i dont know how to use your compiler.could you please help me
#include
using namespace std;
int main() {
int arr[100];
int n;
cout<<“total no. of input”;
cin>>n;
cout<<“enter numbers”;
for(int i=0;i<n;i++){
cin>>arr[i];
}

 for(int i=0;i<n;i++){
 	if(arr[i]>=0){
	 cout<<arr[i]<<endl;
     }
     else
     break;
    }

return 0;
}
i wrote this. please tell my mistake

Hi @tishya_goyal
In this question you dont have to take n as input and also you dont have to print “enter numbers”. You dont have to print arr[i] which is positive instead you have to calculate cumulative sum and print arr[i] till cumulative sum is positive and when cumulative sum becomes negative you have to stop taking input.

Here is your corrected code :

1 Like

okay! i got it.
Thanku so much

If your doubt is resolved, please mark it as resolved.

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.