#include
using namespace std;
int main() {
int n;
cin>>n;
int i;
for(i=0;i<n;i++){
cout<<n;
if(n<0){
break;
}
}
}
WAP until user enter a negative no
Hey @satveersingh12 i think you have misunderstood the question, the question states that to process till the sum is NOT negative and you have not been given n. So you need to initialize a sum variable to zero and whenever you get an input add it to sum if sum is still greater than or equal to zero print that input else break.
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.