Program in C to print series from 1 to 10 and break on 5

Write a program in C to print series from 1 to 10 and break on 5

#include <stdio.h>

void main ()
{
          int a;
          clrscr ();
          for (a=1;a<=10;a++)
          {
                   if (a==5)
                             break;
                   printf ("%d\n",a);
          }
          getch ();
}


Post a Comment