Josif_tepe

Untitled

Dec 13th, 2025
21
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.42 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main(){
  4.     int n;
  5.     cin>>n;
  6.     int niza[n];
  7.     int zbir=0;
  8.     int proizvod=1;
  9.     for(int i=0; i<n; i++){
  10.         cin>>niza[i];
  11.        
  12.     }
  13.     for(int i=0; i<n; i++){
  14.       if( niza[i]%2==0){
  15.           zbir+=niza[i];
  16.       }
  17.       else if(niza[i]%2!=0){
  18.           proizvod*=niza[i];
  19.       }
  20.     }
  21.     cout<<zbir<<" "<<proizvod<<endl;
  22.     return 0;
  23. }
  24.  
Advertisement
Add Comment
Please, Sign In to add comment