Print a series skipping given numbers

C program to print the series from 1 to 10 and skip numbers 6 and 8.

Solution:

#include <stdio.h>
int main()
{
      int i = 1;
      while(i<=10)
      {
            if(i==6||i==8)
            {
                  i++;
                  continue;     /* This statement continues the loop condition if it is true and skips the next statements.*/
            }
            printf("%d ", i);
            i++;
      }   
      return 0;
}


Output:

print series skip 6 & 8