Language: C

#include <stdio.h>

#define N 1000

int
gcd (
  const int a,
  const int b
  )
{
  if ( a == 0 ) return ( b );

  return
  gcd ( b % a, a );
}

int
main (
  int     argc,
  char  * argv[ ]
  )
{
  int res = 1;
  int d[ N ];
  int n;
  int i;

  scanf ( "%d", &n );
  for ( i = 0; i < n; ++i )
  {
    scanf ( "%d", d + i );
  }

  for ( i = 0; i < n; ++i )
  {
    int p = d[ i ];
    int c;

    for ( c = 1; p != i + 1; ++c )
    {
      p = d[ p - 1 ];
    }

    res = ( res / gcd ( res, c ) ) * c;
  }

  printf ( "%d\n", res );

  return ( 0 );
}

toj: ls
1020.c  1024.c  1110.c  1149.c  1402.c  1404.c  1446.c  1510.c  a.out*
toj: cd 
ee17029: ls
Desktop/  Pictures/  a.out*  ee17029  kern/  lab/  missfont.log
ee17029: cd Desktop/
Desktop: ls
Desktop: vi alds1.c

Desktop: cl alds1.c 
alds1.c: In function 'main':
alds1.c:22: error: 'j' undeclared (first use in this function)
alds1.c:22: error: (Each undeclared identifier is reported only once
alds1.c:22: error: for each function it appears in.)
Desktop: ^D
csh終了は"exit"を使用して下さい
Desktop: exit
exit

cDesktop: cl alds1.c 

alds1.c:17: note: not vectorized: number of iterations cannot be computed.
alds1.c:26: note: not vectorized: too many BBs in loop.
alds1.c:37: note: not vectorized: multiple exits.
alds1.c:37: note: vectorized 0 loops in function.
Desktop: ./a.out 
6 5 2 4 6 1 3
5 2 4 6 1 3
2 5 4 6 1 3
2 4 5 6 1 3
2 4 5 6 1 3
1 2 4 5 6 3
1 2 3 4 5 6
Desktop: exit
exit
Desktop: cat alds1.c 
#include <stdio.h>

#define N 100

/** Application main entry point. */
int
main (
  int     argc,
  char  * argv[ ]
  )
{
  int d[ N ];
  int n;
  int i, j;

  scanf ( "%d", &n );
  for ( i = 0; i < n; ++i )
  {
    scanf ( "%d", &d[ i ] );
  }

  for ( j = 1; ; ++j )
  {
    int k;

    for ( i = 0; i < n; ++i )
    {
      if ( i ) putchar ( ' ' );
      printf ( "%d", d[ i ] );
    }
    puts ( "" );
    if ( j >= n ) break ;

    k = d[ j ];
    for ( i = j; i > 0 && d[ i - 1 ] > k; --i )
    {
      d[ i ] = d[ i - 1 ];
    }
    d[ i ] = k;
  }

  return ( 0 );
}

Compiler output:
main.c:52:4: error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token
   52 | toj: ls
      |    ^
main.c:53:1: error: invalid suffix "c" on floating constant
   53 | 1020.c  1024.c  1110.c  1149.c  1402.c  1404.c  1446.c  1510.c  a.out*
      | ^~~~~~
main.c:53:9: error: invalid suffix "c" on floating constant
   53 | 1020.c  1024.c  1110.c  1149.c  1402.c  1404.c  1446.c  1510.c  a.out*
      |         ^~~~~~
main.c:53:17: error: invalid suffix "c" on floating constant
   53 | 1020.c  1024.c  1110.c  1149.c  1402.c  1404.c  1446.c  1510.c  a.out*
      |                 ^~~~~~
main.c:53:25: error: invalid suffix "c" on floating constant
   53 | 1020.c  1024.c  1110.c  1149.c  1402.c  1404.c  1446.c  1510.c  a.out*
      |                         ^~~~~~
main.c:53:33: error: invalid suffix "c" on floating constant
   53 | 1020.c  1024.c  1110.c  1149.c  1402.c  1404.c  1446.c  1510.c  a.out*
      |                                 ^~~~~~
main.c:53:41: error: invalid suffix "c" on floating constant
   53 | 1020.c  1024.c  1110.c  1149.c  1402.c  1404.c  1446.c  1510.c  a.out*
      |                                         ^~~~~~
main.c:53:49: error: invalid suffix "c" on floating constant
   53 | 1020.c  1024.c  1110.c  1149.c  1402.c  1404.c  1446.c  1510.c  a.out*
      |                                                 ^~~~~~
main.c:53:57: error: invalid suffix "c" on floating constant
   53 | 1020.c  1024.c  1110.c  1149.c  1402.c  1404.c  1446.c  1510.c  a.out*
      |                                                         ^~~~~~
main.c:62:22: warning: multi-character character constant [-Wmultichar]
   62 | alds1.c: In function 'main':
      |                      ^~~~~~
main.c:90:9: warning: "N" redefined
   90 | #define N 100
      |         ^
main.c:3:9: note: this is the location of the previous definition
    3 | #define N 1000
      |         ^