c - Shorten or split the code -


please shorten function in order have 25 or less lines! prints possible combination of numbers 0 99,

ex: 00 01, 00 02, 00 03, 00 04, 00 05, ..., 00 99, 01 02, ..., 97 99, 98 99

void    dp_print_comb2(void) {     char    a;     char    b;     char    c;     char    d;      = '0';     b = '0';     while (a <= '9')     {         if (b > '9')         {             a++;             b = '0';         }         c = a;         if (b == '9')             c++;          d = b + 1;         if (b == '9')             d = '0';         while (c <= '9')         {             ok(a, b, c, d);             d++;             if (d > '9')             {                 c++;                 d = '0';             }         }         b++;     } } 

so if there way split function or shorten please me! thanks!

if main , other function needed can put give them too!

ps: started learn c, , making practice! (sorry bad english)

void dp_print_comb2(void){     for(int ab = 0; ab < 100-1; ++ab)         for(int cd = ab + 1; cd < 100; ++cd)             printf("%02d %02d, ", ab, cd);     puts(""); } 

Comments