#include <iostream>
using namespace std;

int main()
{
   int a[] = {24, 98, 35, 46, 37, 53, 60, 24, 11, 19};
   int size_before = 10;
   int size_after = 0;

   for (int i = 0; i < size_before; i++)
   {
      if (a[i] % 2 == 0) // Check if the number is even
      {
         if (i != size_after)
         {
            a[size_after] = a[i];
         }
         size_after++;
      }
   }

   cout << "a: [ ";
   for (int i = 0; i < size_after; i++)
   {
      cout << a[i] << " ";
   }
   cout << "]" << endl;
   cout << "Expected: [ 24 98 46 60 24 ]" << endl;

   return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: