Advertisement
Josif_tepe

Untitled

Mar 15th, 2021
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.66 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int a,n,x,s,z;
  8.     bool flag=true;
  9.     cin>>a;
  10.     x=0;
  11.     s=0;
  12.     z=0;
  13.     int niza[a];
  14.     for(int i=0;i<a;i++)
  15.     {
  16.         cin>>n;
  17.         niza[i]=n;
  18.     }
  19.     for(int i=0; i < a; i++)
  20.     {
  21.         flag=true;
  22.     while(niza[i]>0)
  23.     {
  24.         x++;
  25.         int cifra=niza[i]%10;
  26.         niza[i]/=10;
  27.         if(cifra%2==0)
  28.         {
  29.            flag=true;
  30.         }else
  31.         {
  32.             flag=false;
  33.             break;
  34.         }
  35.     }
  36.     if(flag==true)
  37.     {
  38.         s++;
  39.         z+=x;
  40.     }
  41.     x=0;
  42.     }
  43.     cout<<s<<endl;
  44.     cout<<z<<endl;
  45.     return 0;
  46. }
  47.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement