Advertisement
florinel2102

1175

Nov 16th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.40 KB | None | 0 0
  1. int suma (nod *p)
  2. {
  3.     int x,y;
  4.     x=y=-1;
  5.     unsigned s=0;
  6.     while(p)
  7.     {
  8.         if(x == -1)
  9.             x = p->info;
  10.         else if(y == -1)
  11.             y = p->info;
  12.         else
  13.         {
  14.             if(p->info%2 == 0 && x%2==0 && y%2 == 1){
  15.                 s+=y;
  16.             }
  17.             x = y;
  18.             y = p->info;
  19.         }
  20.         p = p->urm;
  21.     }
  22.     return s;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement