asolntsev

Untitled

Apr 5th, 2011
2,299
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. int n = 1;
  2. int m = 1;
  3. int n_max = 6;
  4.  
  5. for ( n = 1; n <= n_max; n++ )
  6. {
  7.     if ( ( n % 2 ) ==  0 )
  8.     {
  9.         m = n;
  10.         goto even;
  11.     }
  12.     else
  13.     {
  14.         m = n;
  15.         goto odd;
  16.     }
  17. back:;
  18. }
  19.  
  20. even:
  21.     for ( int i = m; i >= 1; i-- )
  22.     {
  23.         char buffer[1024];
  24.         printf( "%i", i );
  25.         if ( i > 1 ) printf( "-" );
  26.     }
  27.     printf( "\n" );
  28.     if ( m >= n_max ) goto exit_label; else goto back;
  29. odd:
  30.     for ( int i = 1; i <= m; i++ )
  31.     {
  32.         char buffer[1024];
  33.         printf( "%i", i );
  34.         if ( i < m ) printf( "-" );
  35.     }
  36.     printf( "\n" );
  37.     if ( m >= n_max ) goto exit_label; else goto back;
  38.  
  39. exit_label:
RAW Paste Data