Code:
#include<stdio.h>
int main(int argc , char *argv[])
{
        int next = 1;
        int range = 1, rangeEnd = 0;
        int nextInRange = 0;
        int prev = 1;
        if(argv[1] == NULL) {
                printf("Usage : ./a.out <range_number>\n");
        } else {
                rangeEnd = atoi(argv[1]);
        }
        for(; range <= rangeEnd ; range++) {
                next = 1;
                prev = 1;
                if(range >= nextInRange) {
                        printf("%d %d ", prev, next);
                        for(; next < range ;) {
                                next = prev + next;
                                printf("%d ", next);
                                prev = next - prev;
                        }
                        nextInRange = next + prev;
                        putchar('\n');
                }
        }
}

Last edited by shabbir; 14May2010 at 14:01.. Reason: Code blocks
abhix95 like this