Advertisement
dirtydevil123

positive array multi

Jul 3rd, 2021
1,430
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.33 KB | None | 0 0
  1.  
  2. #include <iostream>
  3. #include <bits/stdc++.h>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.     int x,i=0;
  10.     cin>>x;
  11. double arr[x];
  12.  
  13. for(int i; i<x;i++){
  14.     cout<<"arr["<<i<<"]:"<<endl;
  15.    cin>>arr[i];
  16.  
  17. }
  18.  
  19. double sum;
  20. for(int j;j<x;j++){
  21.  
  22.     if(arr[j]>= 0){
  23.         sum*=arr[j];
  24.     }
  25. }
  26.  
  27. cout<<sum;
  28.     return 0;
  29. }
  30.  
  31.  
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement