Saturday, January 31, 2015

Loop start (goto statement)

Loop is a very important topic on c programming. It is said that if one does not understand loop clearly then he must not understand the next topics on c. So try to understand the loop hardly.

input:

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

int main()
{
    int a = 1;

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

        if (a<=7)
            goto start;

        return 0;
}

Output :

1234567