Getting prime numbers, custom example I was tasked this in class today, so the teacher could judge where our skills are.

I am not an experienced C++ programmer, and I made a mistake on my sheet, so I came home and wrote this.

I saw other examples online, but this is the solution I came up with. It works from what I can see, and for these test values.

Did I make any mistakes? How can I improve my coding style and algorithm?

#include &lt;iostream&gt;
#include &lt;string&gt;

    int main()
    {
      int intnumbers[10]= { 10,11, 17,20,37,53,44,88,90,42 }; 
      for(int i=0;i&lt;10;i++)
      {
         if(intnumbers[i]%2==1){
          if((intnumbers[i]%3==1) || (intnumbers[i]%3==2) )
          {
              std::cout&lt;&lt;intnumbers[i] &lt;&lt;std::endl;      }
         }

      }
      }
Style improvements:


The use of whitespace here is inconsistent:


int intnumbers[10]= { 10,11, 17,20,37,53,44,88,90,42 };



It's good to pay attention to detail by keeping it consistent:

int intnumbers[10] = { 10, 11, 17, 20, 37, 53, 44, 88, 90, 42 };


The spacing in between will make it a little more readable, even though it may increase the horizontal width.
This could also use some whitespace:


for(int i=0;i&lt;10;i++)



It's good to keep one space between operators and operands so that they can be easily distinguished at first glance.

for (int i = 0; i &lt; 10; i++)

Stick to one length of indentation.  For instance, I see two below the first {, just one after the first if, and four after the second if.  Four is most common in C++, so consider using that everywhere.
You can increase performance a little by outputting '\n' instead of std::endl.  The latter also flushes the buffer, whereas the former does not.
Want to stay ahead of the C++ game a bit (at least in a classroom setting)?  Use a container class such as an std::vector in place of the C array:

const std::vector&lt;int&gt; intnumbers { 10, 11, 17, 20, 37, 53, 44, 88, 90, 42 };


It may not matter that much in this small program without any functions, but it's a good habit for C++ programming.  You'll even benefit from various member functions and bounds-checking.