WeixiangYan/CodeTransOcean huggingface dataset:
Task: String interpolation (included)


C++: #include <string>
#include <iostream>

int main( ) {
   std::string original( "Mary had a X lamb." ) , toBeReplaced( "X" ) ,
      replacement ( "little" ) ;
   std::string newString = original.replace( original.find( "X" ) ,
	 toBeReplaced.length( ) , replacement ) ;
   std::cout << "String after replacement: " << newString << " \n" ;
   return 0 ;
}








COBOL:        IDENTIFICATION DIVISION.
       PROGRAM-ID. interpolation-included.

       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  extra PIC X(6) VALUE "little".

       PROCEDURE DIVISION.
           DISPLAY FUNCTION SUBSTITUTE("Mary had a X lamb.", "X", extra)

           GOBACK
           .
Task: String interpolation (included)





Java: String original = "Mary had a X lamb";
String little = "little";
String replaced = original.replace("X", little); 
System.out.println(replaced);

System.out.printf("Mary had a %s lamb.", little);

String formatted = String.format("Mary had a %s lamb.", little);
System.out.println(formatted);





COBOL:        IDENTIFICATION DIVISION.
       PROGRAM-ID. interpolation-included.

       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  extra PIC X(6) VALUE "little".

       PROCEDURE DIVISION.
           DISPLAY FUNCTION SUBSTITUTE("Mary had a X lamb.", "X", extra)

           GOBACK
           .
Task: String interpolation (included)







Python: >>> original = 'Mary had a %s lamb.'
>>> extra = 'little'
>>> original % extra
'Mary had a little lamb.'



COBOL:        IDENTIFICATION DIVISION.
       PROGRAM-ID. interpolation-included.

       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  extra PIC X(6) VALUE "little".

       PROCEDURE DIVISION.
           DISPLAY FUNCTION SUBSTITUTE("Mary had a X lamb.", "X", extra)

           GOBACK
           .
Task: String interpolation (included)








VB: Dim name as String = "J. Doe"
Dim balance as Double = 123.45
Dim prompt as String = String.Format("Hello {0}, your balance is {1}.", name, balance)
Console.WriteLine(prompt)


COBOL:        IDENTIFICATION DIVISION.
       PROGRAM-ID. interpolation-included.

       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  extra PIC X(6) VALUE "little".

       PROCEDURE DIVISION.
           DISPLAY FUNCTION SUBSTITUTE("Mary had a X lamb.", "X", extra)

           GOBACK
           .
Task: String interpolation (included)




Go: package main

import (
    "fmt"
)

func main() {
    str := "Mary had a %s lamb"
    txt := "little"
    out := fmt.Sprintf(str, txt)
    fmt.Println(out)
}






COBOL:        IDENTIFICATION DIVISION.
       PROGRAM-ID. interpolation-included.

       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  extra PIC X(6) VALUE "little".

       PROCEDURE DIVISION.
           DISPLAY FUNCTION SUBSTITUTE("Mary had a X lamb.", "X", extra)

           GOBACK
           .
Task: String interpolation (included)






PHP: <?php
$extra = 'little';
echo "Mary had a $extra lamb.\n";
printf("Mary had a %s lamb.\n", $extra);
?>
Task: String interpolation (included)






PHP: <?php
$extra = 'little';
echo "Mary had a $extra lamb.\n";
printf("Mary had a %s lamb.\n", $extra);
?>






Ada: with Ada.Strings.Fixed, Ada.Text_IO;
use  Ada.Strings, Ada.Text_IO;
procedure String_Replace is
   Original : constant String := "Mary had a @__@ lamb.";
   Tbr : constant String := "@__@";
   New_Str : constant String := "little";
   Index : Natural := Fixed.Index (Original, Tbr);
begin
   Put_Line (Fixed.Replace_Slice (
     Original, Index, Index + Tbr'Length - 1, New_Str));
end String_Replace;
Task: String interpolation (included)






PHP: <?php
$extra = 'little';
echo "Mary had a $extra lamb.\n";
printf("Mary had a %s lamb.\n", $extra);
?>




COBOL:        IDENTIFICATION DIVISION.
       PROGRAM-ID. interpolation-included.

       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  extra PIC X(6) VALUE "little".

       PROCEDURE DIVISION.
           DISPLAY FUNCTION SUBSTITUTE("Mary had a X lamb.", "X", extra)

           GOBACK
           .
Task: Babbage problem



C#: namespace Babbage_Problem
{
    class iterateNumbers
    {
        public iterateNumbers()
        {
            long baseNumberSquared = 0; 
            long baseNumber = 0;  

            do  
            {
                baseNumber += 1; 
                baseNumberSquared = baseNumber * baseNumber; 
            }
            while (Right6Digits(baseNumberSquared) != 269696); 

            Console.WriteLine("The smallest integer whose square ends in 269,696 is " + baseNumber);
            Console.WriteLine("The square is " + baseNumberSquared);

        }

        private long Right6Digits(long baseNumberSquared)
        {

            string numberAsString = baseNumberSquared.ToString(); 

            if (numberAsString.Length < 6) { return baseNumberSquared; }; 

            numberAsString = numberAsString.Substring(numberAsString.Length - 6);  

            return long.Parse(numberAsString); 

        }
    }
}}









Ada: 












with Ada.Text_IO; 


procedure Babbage_Problem is
   
   
   
   
   

   type Number is range 1 .. 99_736*99_736;
   X: Number := 1; 
   
   
   
   
   
begin
   
   
   
   
   
   while not (((X*X) mod 1_000_000) = 269_696) loop

      
      X := X+1; 
      

   end loop;
   
   
   
   
   
   Ada.Text_IO.Put_Line(Number'Image(X));
   
   
   
   
end Babbage_Problem;
Task: Babbage problem

C: 

#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
 
int main() {
	int current = 0, 	
	    square;		

	
	
	while (((square=current*current) % 1000000 != 269696) && (square<INT_MAX)) {
		current++;
	}

        
	if (square>+INT_MAX)
	    printf("Condition not satisfied before INT_MAX reached.");
	else		   
	    printf ("The smallest number whose square ends in 269696 is %d\n", current);
	   
        
	return 0 ;
}











Ada: 












with Ada.Text_IO; 


procedure Babbage_Problem is
   
   
   
   
   

   type Number is range 1 .. 99_736*99_736;
   X: Number := 1; 
   
   
   
   
   
begin
   
   
   
   
   
   while not (((X*X) mod 1_000_000) = 269_696) loop

      
      X := X+1; 
      

   end loop;
   
   
   
   
   
   Ada.Text_IO.Put_Line(Number'Image(X));
   
   
   
   
end Babbage_Problem;
Task: Babbage problem


C++: #include <iostream>

int main( ) {
   int current = 0 ;
   while ( ( current * current ) % 1000000 != 269696 ) 
      current++ ;
   std::cout << "The square of " << current << " is " << (current * current) << " !\n" ;
   return 0 ;
}










Ada: 












with Ada.Text_IO; 


procedure Babbage_Problem is
   
   
   
   
   

   type Number is range 1 .. 99_736*99_736;
   X: Number := 1; 
   
   
   
   
   
begin
   
   
   
   
   
   while not (((X*X) mod 1_000_000) = 269_696) loop

      
      X := X+1; 
      

   end loop;
   
   
   
   
   
   Ada.Text_IO.Put_Line(Number'Image(X));
   
   
   
   
end Babbage_Problem;
Task: Babbage problem




Go: package main

import "fmt"

func main() {
	const (
		target  = 269696
		modulus = 1000000
	)
	for n := 1; ; n++ { 
		square := n * n
		ending := square % modulus
		if ending == target {
			fmt.Println("The smallest number whose square ends with",
				target, "is", n,
			)
			return
		}
	}
}








Ada: 












with Ada.Text_IO; 


procedure Babbage_Problem is
   
   
   
   
   

   type Number is range 1 .. 99_736*99_736;
   X: Number := 1; 
   
   
   
   
   
begin
   
   
   
   
   
   while not (((X*X) mod 1_000_000) = 269_696) loop

      
      X := X+1; 
      

   end loop;
   
   
   
   
   
   Ada.Text_IO.Put_Line(Number'Image(X));
   
   
   
   
end Babbage_Problem;
Task: Babbage problem





Java: public class Test {

    public static void main(String[] args) {

        
        int n = 0;

        
        do {

            
            n++;

        
        } while (n * n % 1000_000 != 269696);

        
        System.out.println(n);
    }
}







Ada: 












with Ada.Text_IO; 


procedure Babbage_Problem is
   
   
   
   
   

   type Number is range 1 .. 99_736*99_736;
   X: Number := 1; 
   
   
   
   
   
begin
   
   
   
   
   
   while not (((X*X) mod 1_000_000) = 269_696) loop

      
      X := X+1; 
      

   end loop;
   
   
   
   
   
   Ada.Text_IO.Put_Line(Number'Image(X));
   
   
   
   
end Babbage_Problem;
Task: Babbage problem







Python: 


n=0 




while n**2 % 1000000 != 269696:

    
    
    
    
    n += 1 

print(n) 





Ada: 












with Ada.Text_IO; 


procedure Babbage_Problem is
   
   
   
   
   

   type Number is range 1 .. 99_736*99_736;
   X: Number := 1; 
   
   
   
   
   
begin
   
   
   
   
   
   while not (((X*X) mod 1_000_000) = 269_696) loop

      
      X := X+1; 
      

   end loop;
   
   
   
   
   
   Ada.Text_IO.Put_Line(Number'Image(X));
   
   
   
   
end Babbage_Problem;
Task: Babbage problem








VB: Sub Baggage_Problem()
Dim i As Long

    
    i = 520
    
    
    Do While ((i * i) Mod 1000000) <> 269696
        i = i + 4 
    Loop
    Debug.Print "The smallest positive integer whose square ends in the digits 269 696 is : " & i & vbCrLf & _
    "Its square is : " & i * i
End Sub




Ada: 












with Ada.Text_IO; 


procedure Babbage_Problem is
   
   
   
   
   

   type Number is range 1 .. 99_736*99_736;
   X: Number := 1; 
   
   
   
   
   
begin
   
   
   
   
   
   while not (((X*X) mod 1_000_000) = 269_696) loop

      
      X := X+1; 
      

   end loop;
   
   
   
   
   
   Ada.Text_IO.Put_Line(Number'Image(X));
   
   
   
   
end Babbage_Problem;
Task: Babbage problem

C: 

#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
 
int main() {
	int current = 0, 	
	    square;		

	
	
	while (((square=current*current) % 1000000 != 269696) && (square<INT_MAX)) {
		current++;
	}

        
	if (square>+INT_MAX)
	    printf("Condition not satisfied before INT_MAX reached.");
	else		   
	    printf ("The smallest number whose square ends in 269696 is %d\n", current);
	   
        
	return 0 ;
}
Task: Babbage problem



C#: namespace Babbage_Problem
{
    class iterateNumbers
    {
        public iterateNumbers()
        {
            long baseNumberSquared = 0; 
            long baseNumber = 0;  

            do  
            {
                baseNumber += 1; 
                baseNumberSquared = baseNumber * baseNumber; 
            }
            while (Right6Digits(baseNumberSquared) != 269696); 

            Console.WriteLine("The smallest integer whose square ends in 269,696 is " + baseNumber);
            Console.WriteLine("The square is " + baseNumberSquared);

        }

        private long Right6Digits(long baseNumberSquared)
        {

            string numberAsString = baseNumberSquared.ToString(); 

            if (numberAsString.Length < 6) { return baseNumberSquared; }; 

            numberAsString = numberAsString.Substring(numberAsString.Length - 6);  

            return long.Parse(numberAsString); 

        }
    }
}}
Task: Babbage problem


C++: #include <iostream>

int main( ) {
   int current = 0 ;
   while ( ( current * current ) % 1000000 != 269696 ) 
      current++ ;
   std::cout << "The square of " << current << " is " << (current * current) << " !\n" ;
   return 0 ;
}
Task: Babbage problem





Java: public class Test {

    public static void main(String[] args) {

        
        int n = 0;

        
        do {

            
            n++;

        
        } while (n * n % 1000_000 != 269696);

        
        System.out.println(n);
    }
}
Task: Babbage problem







Python: 


n=0 




while n**2 % 1000000 != 269696:

    
    
    
    
    n += 1 

print(n)
Task: Babbage problem








VB: Sub Baggage_Problem()
Dim i As Long

    
    i = 520
    
    
    Do While ((i * i) Mod 1000000) <> 269696
        i = i + 4 
    Loop
    Debug.Print "The smallest positive integer whose square ends in the digits 269 696 is : " & i & vbCrLf & _
    "Its square is : " & i * i
End Sub
Task: Babbage problem




Go: package main

import "fmt"

func main() {
	const (
		target  = 269696
		modulus = 1000000
	)
	for n := 1; ; n++ { 
		square := n * n
		ending := square % modulus
		if ending == target {
			fmt.Println("The smallest number whose square ends with",
				target, "is", n,
			)
			return
		}
	}
}
Task: Babbage problem



C#: namespace Babbage_Problem
{
    class iterateNumbers
    {
        public iterateNumbers()
        {
            long baseNumberSquared = 0; 
            long baseNumber = 0;  

            do  
            {
                baseNumber += 1; 
                baseNumberSquared = baseNumber * baseNumber; 
            }
            while (Right6Digits(baseNumberSquared) != 269696); 

            Console.WriteLine("The smallest integer whose square ends in 269,696 is " + baseNumber);
            Console.WriteLine("The square is " + baseNumberSquared);

        }

        private long Right6Digits(long baseNumberSquared)
        {

            string numberAsString = baseNumberSquared.ToString(); 

            if (numberAsString.Length < 6) { return baseNumberSquared; }; 

            numberAsString = numberAsString.Substring(numberAsString.Length - 6);  

            return long.Parse(numberAsString); 

        }
    }
}}








Fortran:       DO 3 N=1,99736
      IF(MODF(N*N,1000000)-269696)3,4,3
 3    CONTINUE
 4    PRINT 5,N
 5    FORMAT(I6)
      STOP
Task: Babbage problem


C++: #include <iostream>

int main( ) {
   int current = 0 ;
   while ( ( current * current ) % 1000000 != 269696 ) 
      current++ ;
   std::cout << "The square of " << current << " is " << (current * current) << " !\n" ;
   return 0 ;
}









Fortran:       DO 3 N=1,99736
      IF(MODF(N*N,1000000)-269696)3,4,3
 3    CONTINUE
 4    PRINT 5,N
 5    FORMAT(I6)
      STOP
Task: Babbage problem

C: 

#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
 
int main() {
	int current = 0, 	
	    square;		

	
	
	while (((square=current*current) % 1000000 != 269696) && (square<INT_MAX)) {
		current++;
	}

        
	if (square>+INT_MAX)
	    printf("Condition not satisfied before INT_MAX reached.");
	else		   
	    printf ("The smallest number whose square ends in 269696 is %d\n", current);
	   
        
	return 0 ;
}










Fortran:       DO 3 N=1,99736
      IF(MODF(N*N,1000000)-269696)3,4,3
 3    CONTINUE
 4    PRINT 5,N
 5    FORMAT(I6)
      STOP
Task: Babbage problem




Go: package main

import "fmt"

func main() {
	const (
		target  = 269696
		modulus = 1000000
	)
	for n := 1; ; n++ { 
		square := n * n
		ending := square % modulus
		if ending == target {
			fmt.Println("The smallest number whose square ends with",
				target, "is", n,
			)
			return
		}
	}
}







Fortran:       DO 3 N=1,99736
      IF(MODF(N*N,1000000)-269696)3,4,3
 3    CONTINUE
 4    PRINT 5,N
 5    FORMAT(I6)
      STOP
Task: Babbage problem





Java: public class Test {

    public static void main(String[] args) {

        
        int n = 0;

        
        do {

            
            n++;

        
        } while (n * n % 1000_000 != 269696);

        
        System.out.println(n);
    }
}






Fortran:       DO 3 N=1,99736
      IF(MODF(N*N,1000000)-269696)3,4,3
 3    CONTINUE
 4    PRINT 5,N
 5    FORMAT(I6)
      STOP
Task: Babbage problem







Python: 


n=0 




while n**2 % 1000000 != 269696:

    
    
    
    
    n += 1 

print(n) 




Fortran:       DO 3 N=1,99736
      IF(MODF(N*N,1000000)-269696)3,4,3
 3    CONTINUE
 4    PRINT 5,N
 5    FORMAT(I6)
      STOP
Task: Babbage problem








VB: Sub Baggage_Problem()
Dim i As Long

    
    i = 520
    
    
    Do While ((i * i) Mod 1000000) <> 269696
        i = i + 4 
    Loop
    Debug.Print "The smallest positive integer whose square ends in the digits 269 696 is : " & i & vbCrLf & _
    "Its square is : " & i * i
End Sub



Fortran:       DO 3 N=1,99736
      IF(MODF(N*N,1000000)-269696)3,4,3
 3    CONTINUE
 4    PRINT 5,N
 5    FORMAT(I6)
      STOP
Task: Babbage problem






PHP: <?php

for (
    $i = 1 ;                                    // Initial positive integer to check
    ($i * $i) % 1000000 !== 269696 ;            // While i*i does not end with the digits 269,696
    $i++                                        // ... go to next integer
);

echo $i, ' * ', $i, ' = ', ($i * $i), PHP_EOL;  // Print the result





Fortran:       DO 3 N=1,99736
      IF(MODF(N*N,1000000)-269696)3,4,3
 3    CONTINUE
 4    PRINT 5,N
 5    FORMAT(I6)
      STOP
Task: Babbage problem

C: 

#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
 
int main() {
	int current = 0, 	
	    square;		

	
	
	while (((square=current*current) % 1000000 != 269696) && (square<INT_MAX)) {
		current++;
	}

        
	if (square>+INT_MAX)
	    printf("Condition not satisfied before INT_MAX reached.");
	else		   
	    printf ("The smallest number whose square ends in 269696 is %d\n", current);
	   
        
	return 0 ;
}









COBOL: IDENTIFICATION DIVISION.
PROGRAM-ID. BABBAGE-PROGRAM.
* A line beginning with an asterisk is an explanatory note.
* The machine will disregard any such line.
DATA DIVISION.
WORKING-STORAGE SECTION.
* In this part of the program we reserve the storage space we shall
* be using for our variables, using a 'PICTURE' clause to specify
* how many digits the machine is to keep free.
* The prefixed number 77 indicates that these variables do not form part
* of any larger 'record' that we might want to deal with as a whole.
77  N           PICTURE 99999.
* We know that 99,736 is a valid answer.
77  N-SQUARED   PICTURE 9999999999.
77  LAST-SIX    PICTURE 999999.
PROCEDURE DIVISION.
* Here we specify the calculations that the machine is to carry out.
CONTROL-PARAGRAPH.
    PERFORM COMPUTATION-PARAGRAPH VARYING N FROM 1 BY 1
    UNTIL LAST-SIX IS EQUAL TO 269696.
    STOP RUN.
COMPUTATION-PARAGRAPH.
    MULTIPLY N BY N GIVING N-SQUARED.
    MOVE N-SQUARED TO LAST-SIX.
* Since the variable LAST-SIX can hold a maximum of six digits,
* only the final six digits of N-SQUARED will be moved into it:
* the rest will not fit and will simply be discarded.
    IF LAST-SIX IS EQUAL TO 269696 THEN DISPLAY N.
Task: Babbage problem



C#: namespace Babbage_Problem
{
    class iterateNumbers
    {
        public iterateNumbers()
        {
            long baseNumberSquared = 0; 
            long baseNumber = 0;  

            do  
            {
                baseNumber += 1; 
                baseNumberSquared = baseNumber * baseNumber; 
            }
            while (Right6Digits(baseNumberSquared) != 269696); 

            Console.WriteLine("The smallest integer whose square ends in 269,696 is " + baseNumber);
            Console.WriteLine("The square is " + baseNumberSquared);

        }

        private long Right6Digits(long baseNumberSquared)
        {

            string numberAsString = baseNumberSquared.ToString(); 

            if (numberAsString.Length < 6) { return baseNumberSquared; }; 

            numberAsString = numberAsString.Substring(numberAsString.Length - 6);  

            return long.Parse(numberAsString); 

        }
    }
}}







COBOL: IDENTIFICATION DIVISION.
PROGRAM-ID. BABBAGE-PROGRAM.
* A line beginning with an asterisk is an explanatory note.
* The machine will disregard any such line.
DATA DIVISION.
WORKING-STORAGE SECTION.
* In this part of the program we reserve the storage space we shall
* be using for our variables, using a 'PICTURE' clause to specify
* how many digits the machine is to keep free.
* The prefixed number 77 indicates that these variables do not form part
* of any larger 'record' that we might want to deal with as a whole.
77  N           PICTURE 99999.
* We know that 99,736 is a valid answer.
77  N-SQUARED   PICTURE 9999999999.
77  LAST-SIX    PICTURE 999999.
PROCEDURE DIVISION.
* Here we specify the calculations that the machine is to carry out.
CONTROL-PARAGRAPH.
    PERFORM COMPUTATION-PARAGRAPH VARYING N FROM 1 BY 1
    UNTIL LAST-SIX IS EQUAL TO 269696.
    STOP RUN.
COMPUTATION-PARAGRAPH.
    MULTIPLY N BY N GIVING N-SQUARED.
    MOVE N-SQUARED TO LAST-SIX.
* Since the variable LAST-SIX can hold a maximum of six digits,
* only the final six digits of N-SQUARED will be moved into it:
* the rest will not fit and will simply be discarded.
    IF LAST-SIX IS EQUAL TO 269696 THEN DISPLAY N.
Task: Babbage problem


C++: #include <iostream>

int main( ) {
   int current = 0 ;
   while ( ( current * current ) % 1000000 != 269696 ) 
      current++ ;
   std::cout << "The square of " << current << " is " << (current * current) << " !\n" ;
   return 0 ;
}








COBOL: IDENTIFICATION DIVISION.
PROGRAM-ID. BABBAGE-PROGRAM.
* A line beginning with an asterisk is an explanatory note.
* The machine will disregard any such line.
DATA DIVISION.
WORKING-STORAGE SECTION.
* In this part of the program we reserve the storage space we shall
* be using for our variables, using a 'PICTURE' clause to specify
* how many digits the machine is to keep free.
* The prefixed number 77 indicates that these variables do not form part
* of any larger 'record' that we might want to deal with as a whole.
77  N           PICTURE 99999.
* We know that 99,736 is a valid answer.
77  N-SQUARED   PICTURE 9999999999.
77  LAST-SIX    PICTURE 999999.
PROCEDURE DIVISION.
* Here we specify the calculations that the machine is to carry out.
CONTROL-PARAGRAPH.
    PERFORM COMPUTATION-PARAGRAPH VARYING N FROM 1 BY 1
    UNTIL LAST-SIX IS EQUAL TO 269696.
    STOP RUN.
COMPUTATION-PARAGRAPH.
    MULTIPLY N BY N GIVING N-SQUARED.
    MOVE N-SQUARED TO LAST-SIX.
* Since the variable LAST-SIX can hold a maximum of six digits,
* only the final six digits of N-SQUARED will be moved into it:
* the rest will not fit and will simply be discarded.
    IF LAST-SIX IS EQUAL TO 269696 THEN DISPLAY N.
Task: Babbage problem





Java: public class Test {

    public static void main(String[] args) {

        
        int n = 0;

        
        do {

            
            n++;

        
        } while (n * n % 1000_000 != 269696);

        
        System.out.println(n);
    }
}





COBOL: IDENTIFICATION DIVISION.
PROGRAM-ID. BABBAGE-PROGRAM.
* A line beginning with an asterisk is an explanatory note.
* The machine will disregard any such line.
DATA DIVISION.
WORKING-STORAGE SECTION.
* In this part of the program we reserve the storage space we shall
* be using for our variables, using a 'PICTURE' clause to specify
* how many digits the machine is to keep free.
* The prefixed number 77 indicates that these variables do not form part
* of any larger 'record' that we might want to deal with as a whole.
77  N           PICTURE 99999.
* We know that 99,736 is a valid answer.
77  N-SQUARED   PICTURE 9999999999.
77  LAST-SIX    PICTURE 999999.
PROCEDURE DIVISION.
* Here we specify the calculations that the machine is to carry out.
CONTROL-PARAGRAPH.
    PERFORM COMPUTATION-PARAGRAPH VARYING N FROM 1 BY 1
    UNTIL LAST-SIX IS EQUAL TO 269696.
    STOP RUN.
COMPUTATION-PARAGRAPH.
    MULTIPLY N BY N GIVING N-SQUARED.
    MOVE N-SQUARED TO LAST-SIX.
* Since the variable LAST-SIX can hold a maximum of six digits,
* only the final six digits of N-SQUARED will be moved into it:
* the rest will not fit and will simply be discarded.
    IF LAST-SIX IS EQUAL TO 269696 THEN DISPLAY N.