> Do any one know how to print numbers from 0 to 100 or 100 to 0
> with out using loops.( I thik it is not proper to use goto also.) If any
> one knows please help me solving this problem.
#include <stdio.h>
#include <stdlib.h>
void
prin_down ( int i, int min )
{
if ( i % 8 == 0 )
puts ( "" );
printf ( "%-3d\t", i );
if ( i > min )
prin_down( --i, min );
return;
}
void
prin_up ( int i, int max )
{
if ( i % 8 == 0 )
puts ( "" );
printf ( "%-3d\t", i );
if ( i < max )
prin_up ( ++i, max );
return;
}
int
main ( void )
{
/* ascending by default */
/*prin ( 1, 100 );*/
prin_up ( 1, 100 );
puts ( "" );
prin_down ( 100, 1 );
return EXIT_SUCCESS;
}