#include <iostream>
using namespace std ;
int main (){
int n , sum ;
int c[200];
sum = 0 ;
// This program allows to calulate the sum of only positive numbers
cout<<" Enter the number of psotioive numbers you want to add " ;
cin>> n ;
for(int i=0 ; i<n; i++){
cout<<" Enter the number you want to add ";
cin>>c[i];
sum +=c[i] ;
if(c[i]<0){
cout<<" \nYou entered a negative number ";
sum-= c[i] ;// concel the addiction
i--; // decrement the counter to counteract the increment
} }
cout <<"The sum of the positive numbers is "<<sum <<endl <<endl<<endl;
return 0 ;
}
there are more samples on the left