#include
using namespace std;
int main() {
int n;
cin>>n;
int a[n];
for(int i=1; i<=n; i++){
cin>>a[i];
}
int sum=0;
while(sum>0){
for(int i=1; i<=n; i++){
sum=sum+a[i];
cout<<a[i]<<endl;
}
}
return 0;
}
Why my code not giving me any output it only show compilaion sucessful
hi @rathidevesh906_1dcc73a061c159bb, there is noting as such that u can store in array as no size is given u need to print till the sum is not negative here’s the updated code with comments https://ide.codingblocks.com/s/662818
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.