Monday, February 2, 2015

Do loop and comparison with goto statement

Do loop is same as other loop. Do loop works with only one condition. One feature is, do loop do minimum one time of the work it supposed to do.

Input :

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int i;

  ////  i=1;

 ///   do
 ////   {
 ////       printf ("%d",i);
   ////     i++;
  ////  }
 ////   while (i<=5);


  i=1;

  start:
      printf ("%d",i);
      i++;

      if (i<=5)
        goto start;

      return 0;

}


OutPut:L
12345

No comments:

Post a Comment