Program in C to print even & odd numbers from 20 to 1

Write a program in C to print even & odd numbers from 20 to 1

#include <stdio.h>

void main ()
{
          int a;
          clrscr ();
          a=20;
          while (a>=1)
          {
                   if (a%2==0)
                             printf ("%d\t",a);
                   else
                             printf ("%d\n",a);
                   a--;
          }
          getch ();
}


Post a Comment