Varianta 25 / Subiectul 3 / Problema 3 |
#include<iostream.h> int n,k,a[100]; void f(int n,int a[100],int &k) {k=0; int g=0; for(int i=n-1;i>=0;i--) if(a[i]%2==0){k=k*10+a[i];g++;} if(g==0)k=-1; } void main() {cin>>n; for(int i=0;i<n;i++) cin>>a[i]; f(n,a,k); cout<<k; } |