WeixiangYan/CodeTransOcean huggingface dataset:
Task: Loops_For




Go: package main

import "fmt"

func main() {
    for i := 1; i <= 5; i++ {
        for j := 1; j <= i; j++ {
            fmt.Printf("*")
        }
        fmt.Printf("\n")
    }
}








Ada: for I in 1..5 loop
   for J in 1..I loop
      Put("*");
   end loop;
   New_Line;
end loop;
Task: Loops_For





Java: for (Integer i = 0; i < 5; i++) {
    String line = '';

    for (Integer j = 0; j < i; j++) {
        line += '*';
    }

    System.debug(line);
}

List<String> lines = new List<String> {
    '*',
    '**',
    '***',
    '****',
    '*****'
};

for (String line : lines) {
    System.debug(line);
}







Ada: for I in 1..5 loop
   for J in 1..I loop
      Put("*");
   end loop;
   New_Line;
end loop;
Task: Loops_For







Python: for i in 1..5:
  for j in 1..i:
    stdout.write("*")
  echo("")





Ada: for I in 1..5 loop
   for J in 1..I loop
      Put("*");
   end loop;
   New_Line;
end loop;
Task: Loops_For








VB: Public OutConsole As Scripting.TextStream
For i = 0 To 4
    For j = 0 To i
        OutConsole.Write "*"
    Next j 
    OutConsole.WriteLine
Next i




Ada: for I in 1..5 loop
   for J in 1..I loop
      Put("*");
   end loop;
   New_Line;
end loop;
Task: Loops_For

C: int i, j;
for (i = 1; i <= 5; i++) {
  for (j = 1; j <= i; j++)
    putchar('*');
  puts("");
}
Task: Loops_For



C#: using System;

class Program {
    static void Main(string[] args)
    {
        for (int i = 0; i < 5; i++)
        {
            for (int j = 0; j <= i; j++)
            {
                Console.Write("*");
            }
            Console.WriteLine();
        }
    }
}
Task: Loops_For


C++: for(int i = 0; i < 5; ++i) {
  for(int j = 0; j < i; ++j)
    std::cout.put('*');

  std::cout.put('\n');
}
Task: Loops_For





Java: for (Integer i = 0; i < 5; i++) {
    String line = '';

    for (Integer j = 0; j < i; j++) {
        line += '*';
    }

    System.debug(line);
}

List<String> lines = new List<String> {
    '*',
    '**',
    '***',
    '****',
    '*****'
};

for (String line : lines) {
    System.debug(line);
}
Task: Loops_For







Python: for i in 1..5:
  for j in 1..i:
    stdout.write("*")
  echo("")
Task: Loops_For








VB: Public OutConsole As Scripting.TextStream
For i = 0 To 4
    For j = 0 To i
        OutConsole.Write "*"
    Next j 
    OutConsole.WriteLine
Next i
Task: Loops_For




Go: package main

import "fmt"

func main() {
    for i := 1; i <= 5; i++ {
        for j := 1; j <= i; j++ {
            fmt.Printf("*")
        }
        fmt.Printf("\n")
    }
}
Task: Loops_For



C#: using System;

class Program {
    static void Main(string[] args)
    {
        for (int i = 0; i < 5; i++)
        {
            for (int j = 0; j <= i; j++)
            {
                Console.Write("*");
            }
            Console.WriteLine();
        }
    }
}








Fortran: C     WARNING: This program is not valid ANSI FORTRAN 77 code. It uses
C     one nonstandard character on the line labelled 5001. Many F77
C     compilers should be okay with it, but it is *not* standard.
      PROGRAM FORLOOP
        INTEGER I, J

        DO 20 I = 1, 5
          DO 10 J = 1, I
C           Print the asterisk.
            WRITE (*,5001) '*'
   10     CONTINUE
C         Print a newline.
          WRITE (*,5000) ''
   20   CONTINUE

        STOP

 5000   FORMAT (A)
C       Standard FORTRAN 77 is completely incapable of completing a
C       WRITE statement without printing a newline. If you wanted to
C       write this program in valid F77, you would have to come up with
C       a creative way of printing varying numbers of asterisks in a
C       single write statement.
C
C       The dollar sign at the end of the format is a nonstandard
C       character. It tells the compiler not to print a newline. If you
C       are actually using FORTRAN 77, you should figure out what your
C       particular compiler accepts. If you are actually using Fortran
C       90 or later, you should replace this line with the commented
C       line that follows it.
 5001   FORMAT (A, $)
C5001   FORMAT (A, ADVANCE='NO')
      END
Task: Loops_For


C++: for(int i = 0; i < 5; ++i) {
  for(int j = 0; j < i; ++j)
    std::cout.put('*');

  std::cout.put('\n');
}









Fortran: C     WARNING: This program is not valid ANSI FORTRAN 77 code. It uses
C     one nonstandard character on the line labelled 5001. Many F77
C     compilers should be okay with it, but it is *not* standard.
      PROGRAM FORLOOP
        INTEGER I, J

        DO 20 I = 1, 5
          DO 10 J = 1, I
C           Print the asterisk.
            WRITE (*,5001) '*'
   10     CONTINUE
C         Print a newline.
          WRITE (*,5000) ''
   20   CONTINUE

        STOP

 5000   FORMAT (A)
C       Standard FORTRAN 77 is completely incapable of completing a
C       WRITE statement without printing a newline. If you wanted to
C       write this program in valid F77, you would have to come up with
C       a creative way of printing varying numbers of asterisks in a
C       single write statement.
C
C       The dollar sign at the end of the format is a nonstandard
C       character. It tells the compiler not to print a newline. If you
C       are actually using FORTRAN 77, you should figure out what your
C       particular compiler accepts. If you are actually using Fortran
C       90 or later, you should replace this line with the commented
C       line that follows it.
 5001   FORMAT (A, $)
C5001   FORMAT (A, ADVANCE='NO')
      END
Task: Loops_For

C: int i, j;
for (i = 1; i <= 5; i++) {
  for (j = 1; j <= i; j++)
    putchar('*');
  puts("");
}










Fortran: C     WARNING: This program is not valid ANSI FORTRAN 77 code. It uses
C     one nonstandard character on the line labelled 5001. Many F77
C     compilers should be okay with it, but it is *not* standard.
      PROGRAM FORLOOP
        INTEGER I, J

        DO 20 I = 1, 5
          DO 10 J = 1, I
C           Print the asterisk.
            WRITE (*,5001) '*'
   10     CONTINUE
C         Print a newline.
          WRITE (*,5000) ''
   20   CONTINUE

        STOP

 5000   FORMAT (A)
C       Standard FORTRAN 77 is completely incapable of completing a
C       WRITE statement without printing a newline. If you wanted to
C       write this program in valid F77, you would have to come up with
C       a creative way of printing varying numbers of asterisks in a
C       single write statement.
C
C       The dollar sign at the end of the format is a nonstandard
C       character. It tells the compiler not to print a newline. If you
C       are actually using FORTRAN 77, you should figure out what your
C       particular compiler accepts. If you are actually using Fortran
C       90 or later, you should replace this line with the commented
C       line that follows it.
 5001   FORMAT (A, $)
C5001   FORMAT (A, ADVANCE='NO')
      END
Task: Loops_For




Go: package main

import "fmt"

func main() {
    for i := 1; i <= 5; i++ {
        for j := 1; j <= i; j++ {
            fmt.Printf("*")
        }
        fmt.Printf("\n")
    }
}







Fortran: C     WARNING: This program is not valid ANSI FORTRAN 77 code. It uses
C     one nonstandard character on the line labelled 5001. Many F77
C     compilers should be okay with it, but it is *not* standard.
      PROGRAM FORLOOP
        INTEGER I, J

        DO 20 I = 1, 5
          DO 10 J = 1, I
C           Print the asterisk.
            WRITE (*,5001) '*'
   10     CONTINUE
C         Print a newline.
          WRITE (*,5000) ''
   20   CONTINUE

        STOP

 5000   FORMAT (A)
C       Standard FORTRAN 77 is completely incapable of completing a
C       WRITE statement without printing a newline. If you wanted to
C       write this program in valid F77, you would have to come up with
C       a creative way of printing varying numbers of asterisks in a
C       single write statement.
C
C       The dollar sign at the end of the format is a nonstandard
C       character. It tells the compiler not to print a newline. If you
C       are actually using FORTRAN 77, you should figure out what your
C       particular compiler accepts. If you are actually using Fortran
C       90 or later, you should replace this line with the commented
C       line that follows it.
 5001   FORMAT (A, $)
C5001   FORMAT (A, ADVANCE='NO')
      END
Task: Loops_For





Java: for (Integer i = 0; i < 5; i++) {
    String line = '';

    for (Integer j = 0; j < i; j++) {
        line += '*';
    }

    System.debug(line);
}

List<String> lines = new List<String> {
    '*',
    '**',
    '***',
    '****',
    '*****'
};

for (String line : lines) {
    System.debug(line);
}






Fortran: C     WARNING: This program is not valid ANSI FORTRAN 77 code. It uses
C     one nonstandard character on the line labelled 5001. Many F77
C     compilers should be okay with it, but it is *not* standard.
      PROGRAM FORLOOP
        INTEGER I, J

        DO 20 I = 1, 5
          DO 10 J = 1, I
C           Print the asterisk.
            WRITE (*,5001) '*'
   10     CONTINUE
C         Print a newline.
          WRITE (*,5000) ''
   20   CONTINUE

        STOP

 5000   FORMAT (A)
C       Standard FORTRAN 77 is completely incapable of completing a
C       WRITE statement without printing a newline. If you wanted to
C       write this program in valid F77, you would have to come up with
C       a creative way of printing varying numbers of asterisks in a
C       single write statement.
C
C       The dollar sign at the end of the format is a nonstandard
C       character. It tells the compiler not to print a newline. If you
C       are actually using FORTRAN 77, you should figure out what your
C       particular compiler accepts. If you are actually using Fortran
C       90 or later, you should replace this line with the commented
C       line that follows it.
 5001   FORMAT (A, $)
C5001   FORMAT (A, ADVANCE='NO')
      END
Task: Loops_For







Python: for i in 1..5:
  for j in 1..i:
    stdout.write("*")
  echo("")




Fortran: C     WARNING: This program is not valid ANSI FORTRAN 77 code. It uses
C     one nonstandard character on the line labelled 5001. Many F77
C     compilers should be okay with it, but it is *not* standard.
      PROGRAM FORLOOP
        INTEGER I, J

        DO 20 I = 1, 5
          DO 10 J = 1, I
C           Print the asterisk.
            WRITE (*,5001) '*'
   10     CONTINUE
C         Print a newline.
          WRITE (*,5000) ''
   20   CONTINUE

        STOP

 5000   FORMAT (A)
C       Standard FORTRAN 77 is completely incapable of completing a
C       WRITE statement without printing a newline. If you wanted to
C       write this program in valid F77, you would have to come up with
C       a creative way of printing varying numbers of asterisks in a
C       single write statement.
C
C       The dollar sign at the end of the format is a nonstandard
C       character. It tells the compiler not to print a newline. If you
C       are actually using FORTRAN 77, you should figure out what your
C       particular compiler accepts. If you are actually using Fortran
C       90 or later, you should replace this line with the commented
C       line that follows it.
 5001   FORMAT (A, $)
C5001   FORMAT (A, ADVANCE='NO')
      END
Task: Loops_For








VB: Public OutConsole As Scripting.TextStream
For i = 0 To 4
    For j = 0 To i
        OutConsole.Write "*"
    Next j 
    OutConsole.WriteLine
Next i



Fortran: C     WARNING: This program is not valid ANSI FORTRAN 77 code. It uses
C     one nonstandard character on the line labelled 5001. Many F77
C     compilers should be okay with it, but it is *not* standard.
      PROGRAM FORLOOP
        INTEGER I, J

        DO 20 I = 1, 5
          DO 10 J = 1, I
C           Print the asterisk.
            WRITE (*,5001) '*'
   10     CONTINUE
C         Print a newline.
          WRITE (*,5000) ''
   20   CONTINUE

        STOP

 5000   FORMAT (A)
C       Standard FORTRAN 77 is completely incapable of completing a
C       WRITE statement without printing a newline. If you wanted to
C       write this program in valid F77, you would have to come up with
C       a creative way of printing varying numbers of asterisks in a
C       single write statement.
C
C       The dollar sign at the end of the format is a nonstandard
C       character. It tells the compiler not to print a newline. If you
C       are actually using FORTRAN 77, you should figure out what your
C       particular compiler accepts. If you are actually using Fortran
C       90 or later, you should replace this line with the commented
C       line that follows it.
 5001   FORMAT (A, $)
C5001   FORMAT (A, ADVANCE='NO')
      END
Task: Loops_For






PHP: for ($i = 1; $i <= 5; $i++) {
  for ($j = 1; $j <= $i; $j++) {
    echo '*';
  }
  echo "\n";
}





Fortran: C     WARNING: This program is not valid ANSI FORTRAN 77 code. It uses
C     one nonstandard character on the line labelled 5001. Many F77
C     compilers should be okay with it, but it is *not* standard.
      PROGRAM FORLOOP
        INTEGER I, J

        DO 20 I = 1, 5
          DO 10 J = 1, I
C           Print the asterisk.
            WRITE (*,5001) '*'
   10     CONTINUE
C         Print a newline.
          WRITE (*,5000) ''
   20   CONTINUE

        STOP

 5000   FORMAT (A)
C       Standard FORTRAN 77 is completely incapable of completing a
C       WRITE statement without printing a newline. If you wanted to
C       write this program in valid F77, you would have to come up with
C       a creative way of printing varying numbers of asterisks in a
C       single write statement.
C
C       The dollar sign at the end of the format is a nonstandard
C       character. It tells the compiler not to print a newline. If you
C       are actually using FORTRAN 77, you should figure out what your
C       particular compiler accepts. If you are actually using Fortran
C       90 or later, you should replace this line with the commented
C       line that follows it.
 5001   FORMAT (A, $)
C5001   FORMAT (A, ADVANCE='NO')
      END
Task: Loops_For

C: int i, j;
for (i = 1; i <= 5; i++) {
  for (j = 1; j <= i; j++)
    putchar('*');
  puts("");
}









COBOL:        IDENTIFICATION DIVISION.
       PROGRAM-ID. Display-Triangle.

       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  Outer-Counter PIC 9.
       01  Inner-Counter PIC 9. 

       PROCEDURE DIVISION.
       PERFORM VARYING Outer-Counter FROM 1 BY 1 UNTIL 5 < Outer-Counter

           PERFORM VARYING Inner-Counter FROM 1 BY 1
                   UNTIL Outer-Counter < Inner-Counter
               DISPLAY "*" NO ADVANCING
           END-PERFORM

           DISPLAY "" 
       END-PERFORM

       GOBACK
       .
Task: Loops_For



C#: using System;

class Program {
    static void Main(string[] args)
    {
        for (int i = 0; i < 5; i++)
        {
            for (int j = 0; j <= i; j++)
            {
                Console.Write("*");
            }
            Console.WriteLine();
        }
    }
}







COBOL:        IDENTIFICATION DIVISION.
       PROGRAM-ID. Display-Triangle.

       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  Outer-Counter PIC 9.
       01  Inner-Counter PIC 9. 

       PROCEDURE DIVISION.
       PERFORM VARYING Outer-Counter FROM 1 BY 1 UNTIL 5 < Outer-Counter

           PERFORM VARYING Inner-Counter FROM 1 BY 1
                   UNTIL Outer-Counter < Inner-Counter
               DISPLAY "*" NO ADVANCING
           END-PERFORM

           DISPLAY "" 
       END-PERFORM

       GOBACK
       .
Task: Loops_For


C++: for(int i = 0; i < 5; ++i) {
  for(int j = 0; j < i; ++j)
    std::cout.put('*');

  std::cout.put('\n');
}








COBOL:        IDENTIFICATION DIVISION.
       PROGRAM-ID. Display-Triangle.

       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  Outer-Counter PIC 9.
       01  Inner-Counter PIC 9. 

       PROCEDURE DIVISION.
       PERFORM VARYING Outer-Counter FROM 1 BY 1 UNTIL 5 < Outer-Counter

           PERFORM VARYING Inner-Counter FROM 1 BY 1
                   UNTIL Outer-Counter < Inner-Counter
               DISPLAY "*" NO ADVANCING
           END-PERFORM

           DISPLAY "" 
       END-PERFORM

       GOBACK
       .
Task: Loops_For





Java: for (Integer i = 0; i < 5; i++) {
    String line = '';

    for (Integer j = 0; j < i; j++) {
        line += '*';
    }

    System.debug(line);
}

List<String> lines = new List<String> {
    '*',
    '**',
    '***',
    '****',
    '*****'
};

for (String line : lines) {
    System.debug(line);
}





COBOL:        IDENTIFICATION DIVISION.
       PROGRAM-ID. Display-Triangle.

       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  Outer-Counter PIC 9.
       01  Inner-Counter PIC 9. 

       PROCEDURE DIVISION.
       PERFORM VARYING Outer-Counter FROM 1 BY 1 UNTIL 5 < Outer-Counter

           PERFORM VARYING Inner-Counter FROM 1 BY 1
                   UNTIL Outer-Counter < Inner-Counter
               DISPLAY "*" NO ADVANCING
           END-PERFORM

           DISPLAY "" 
       END-PERFORM

       GOBACK
       .
Task: Loops_For







Python: for i in 1..5:
  for j in 1..i:
    stdout.write("*")
  echo("")



COBOL:        IDENTIFICATION DIVISION.
       PROGRAM-ID. Display-Triangle.

       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  Outer-Counter PIC 9.
       01  Inner-Counter PIC 9. 

       PROCEDURE DIVISION.
       PERFORM VARYING Outer-Counter FROM 1 BY 1 UNTIL 5 < Outer-Counter

           PERFORM VARYING Inner-Counter FROM 1 BY 1
                   UNTIL Outer-Counter < Inner-Counter
               DISPLAY "*" NO ADVANCING
           END-PERFORM

           DISPLAY "" 
       END-PERFORM

       GOBACK
       .
Task: Loops_For








VB: Public OutConsole As Scripting.TextStream
For i = 0 To 4
    For j = 0 To i
        OutConsole.Write "*"
    Next j 
    OutConsole.WriteLine
Next i


COBOL:        IDENTIFICATION DIVISION.
       PROGRAM-ID. Display-Triangle.

       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  Outer-Counter PIC 9.
       01  Inner-Counter PIC 9. 

       PROCEDURE DIVISION.
       PERFORM VARYING Outer-Counter FROM 1 BY 1 UNTIL 5 < Outer-Counter

           PERFORM VARYING Inner-Counter FROM 1 BY 1
                   UNTIL Outer-Counter < Inner-Counter
               DISPLAY "*" NO ADVANCING
           END-PERFORM

           DISPLAY "" 
       END-PERFORM

       GOBACK
       .
Task: Loops_For




Go: package main

import "fmt"

func main() {
    for i := 1; i <= 5; i++ {
        for j := 1; j <= i; j++ {
            fmt.Printf("*")
        }
        fmt.Printf("\n")
    }
}






COBOL:        IDENTIFICATION DIVISION.
       PROGRAM-ID. Display-Triangle.

       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  Outer-Counter PIC 9.
       01  Inner-Counter PIC 9. 

       PROCEDURE DIVISION.
       PERFORM VARYING Outer-Counter FROM 1 BY 1 UNTIL 5 < Outer-Counter

           PERFORM VARYING Inner-Counter FROM 1 BY 1
                   UNTIL Outer-Counter < Inner-Counter
               DISPLAY "*" NO ADVANCING
           END-PERFORM

           DISPLAY "" 
       END-PERFORM

       GOBACK
       .
Task: Loops_For






PHP: for ($i = 1; $i <= 5; $i++) {
  for ($j = 1; $j <= $i; $j++) {
    echo '*';
  }
  echo "\n";
}
Task: Loops_For






PHP: for ($i = 1; $i <= 5; $i++) {
  for ($j = 1; $j <= $i; $j++) {
    echo '*';
  }
  echo "\n";
}






Ada: for I in 1..5 loop
   for J in 1..I loop
      Put("*");
   end loop;
   New_Line;
end loop;
Task: Loops_For






PHP: for ($i = 1; $i <= 5; $i++) {
  for ($j = 1; $j <= $i; $j++) {
    echo '*';
  }
  echo "\n";
}




COBOL:        IDENTIFICATION DIVISION.
       PROGRAM-ID. Display-Triangle.

       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  Outer-Counter PIC 9.
       01  Inner-Counter PIC 9. 

       PROCEDURE DIVISION.
       PERFORM VARYING Outer-Counter FROM 1 BY 1 UNTIL 5 < Outer-Counter

           PERFORM VARYING Inner-Counter FROM 1 BY 1
                   UNTIL Outer-Counter < Inner-Counter
               DISPLAY "*" NO ADVANCING
           END-PERFORM

           DISPLAY "" 
       END-PERFORM

       GOBACK
       .
Task: Loops_Downward for



C#: for (int i = 10; i >= 0; i--)
{
   Console.WriteLine(i);
}









Ada: for I in reverse 0..10 loop
   Put_Line(Integer'Image(I));
end loop;
Task: Loops_Downward for

C: int i;
for(i = 10; i >= 0; --i)
  printf("%d\n",i);











Ada: for I in reverse 0..10 loop
   Put_Line(Integer'Image(I));
end loop;
Task: Loops_Downward for


C++: for(int i = 10; i >= 0; --i)
  std::cout << i << "\n";










Ada: for I in reverse 0..10 loop
   Put_Line(Integer'Image(I));
end loop;
Task: Loops_Downward for




Go: for i := 10; i >= 0; i-- {
  fmt.Println(i)
}








Ada: for I in reverse 0..10 loop
   Put_Line(Integer'Image(I));
end loop;
Task: Loops_Downward for





Java: for (int i = 10; i >= 0; i--) {
    System.out.println(i);
}







Ada: for I in reverse 0..10 loop
   Put_Line(Integer'Image(I));
end loop;
Task: Loops_Downward for







Python: for i in xrange(10, -1, -1):
    print i





Ada: for I in reverse 0..10 loop
   Put_Line(Integer'Image(I));
end loop;
Task: Loops_Downward for








VB: For i = 10 To 0 Step -1
   Debug.Print i
Next i




Ada: for I in reverse 0..10 loop
   Put_Line(Integer'Image(I));
end loop;
Task: Loops_Downward for

C: int i;
for(i = 10; i >= 0; --i)
  printf("%d\n",i);
Task: Loops_Downward for



C#: for (int i = 10; i >= 0; i--)
{
   Console.WriteLine(i);
}
Task: Loops_Downward for


C++: for(int i = 10; i >= 0; --i)
  std::cout << i << "\n";
Task: Loops_Downward for





Java: for (int i = 10; i >= 0; i--) {
    System.out.println(i);
}
Task: Loops_Downward for







Python: for i in xrange(10, -1, -1):
    print i
Task: Loops_Downward for








VB: For i = 10 To 0 Step -1
   Debug.Print i
Next i
Task: Loops_Downward for




Go: for i := 10; i >= 0; i-- {
  fmt.Println(i)
}
Task: Loops_Downward for



C#: for (int i = 10; i >= 0; i--)
{
   Console.WriteLine(i);
}








Fortran: DO i = 10, 0, -1
  WRITE(*, *) i
END DO
Task: Loops_Downward for


C++: for(int i = 10; i >= 0; --i)
  std::cout << i << "\n";









Fortran: DO i = 10, 0, -1
  WRITE(*, *) i
END DO
Task: Loops_Downward for

C: int i;
for(i = 10; i >= 0; --i)
  printf("%d\n",i);










Fortran: DO i = 10, 0, -1
  WRITE(*, *) i
END DO
Task: Loops_Downward for





Java: for (int i = 10; i >= 0; i--) {
    System.out.println(i);
}






Fortran: DO i = 10, 0, -1
  WRITE(*, *) i
END DO
Task: Loops_Downward for







Python: for i in xrange(10, -1, -1):
    print i




Fortran: DO i = 10, 0, -1
  WRITE(*, *) i
END DO
Task: Loops_Downward for








VB: For i = 10 To 0 Step -1
   Debug.Print i
Next i



Fortran: DO i = 10, 0, -1
  WRITE(*, *) i
END DO
Task: Loops_Downward for






PHP: for ($i = 10; $i >= 0; $i--)
  echo "$i\n";





Fortran: DO i = 10, 0, -1
  WRITE(*, *) i
END DO
Task: Loops_Downward for

C: int i;
for(i = 10; i >= 0; --i)
  printf("%d\n",i);









COBOL: identification division.
program-id. countdown.
environment division.
data division.
working-storage section.
01	counter 		pic 99.
	88	counter-done	value 0.
01	counter-disp	pic Z9.
procedure division.
	perform with test after varying counter from 10 by -1 until counter-done
		move counter to counter-disp
		display counter-disp
	end-perform
	stop run.
Task: Loops_Downward for



C#: for (int i = 10; i >= 0; i--)
{
   Console.WriteLine(i);
}







COBOL: identification division.
program-id. countdown.
environment division.
data division.
working-storage section.
01	counter 		pic 99.
	88	counter-done	value 0.
01	counter-disp	pic Z9.
procedure division.
	perform with test after varying counter from 10 by -1 until counter-done
		move counter to counter-disp
		display counter-disp
	end-perform
	stop run.
Task: Loops_Downward for


C++: for(int i = 10; i >= 0; --i)
  std::cout << i << "\n";








COBOL: identification division.
program-id. countdown.
environment division.
data division.
working-storage section.
01	counter 		pic 99.
	88	counter-done	value 0.
01	counter-disp	pic Z9.
procedure division.
	perform with test after varying counter from 10 by -1 until counter-done
		move counter to counter-disp
		display counter-disp
	end-perform
	stop run.