fork download
  1. #include <iostream>
  2. using namespace std;
  3. int main(){
  4. int n,i,x,k=0;
  5. cout << "Intr. nr de elem. a sirului: "; cin>>n;
  6. for(i=1;i<=n;i++){
  7. cout<<"x= ";cin>>x;
  8. if(x>0)
  9. k++;
  10. }
  11. if(k!=0)
  12. cout<<k<<endl;
  13. else cout<<"Nu exista numere pozitive!"<<endl;
  14. return 0;
  15. }
  16.  
Success #stdin #stdout 0s 5288KB
stdin
45
stdout
Intr. nr de elem. a sirului: x= x= x= x= x= x= x= x= x= x= x= x= x= x= x= x= x= x= x= x= x= x= x= x= x= x= x= x= x= x= x= x= x= x= x= x= x= x= x= x= x= x= x= x= x= 45