Sunday 12 January 2014

c program to print 0 to 5 and 5 to 0 without using any loop

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

int main(){
    static int v = 0;
    static int r = 5;
    {
    if(v < 6)
    {
        printf("    %d",v++);
        main();
    }
    if(r >= 0 )
    {
        printf("    %d",r--);
        main();
    }
    }
return 0;
}

No comments:

Post a Comment