“Sequence control structure” refers to the line-by-line execution by which statements are executed sequentially, in the same order in which they appear in the program. They might, for example, carry out a series of read or write operations, arithmetic operations, or assignments to variables.

The sequence control structure is the simplest of the three fundamental control structures that you learned about here. The following program shows an example of statements that are executed sequentially.

PHP

<?php
  echo "Enter a number: ";
  $a = trim(fgets(STDIN));

  $b = $a * $a;

  echo "The square of ", $a, " is ", $b;
?>

Java

public static void main(String[] args) throws java.io.IOException {
  java.io.BufferedReader cin = new java.io.
          BufferedReader(new java.io.InputStreamReader(System.in));
  double a, b;

  System.out.print("Enter a number: ");
  a = Double.parseDouble(cin.readLine());

  b = a * a;

  System.out.println("The square of " + a + " is " + b);
}

C++

#include <iostream>
using namespace std;
int main() {
  double a, b;

  cout << "Enter a number: ";
  cin >> a;

  b = a * a;

  cout << "The square of " << a << " is " << b;
  return 0;
}

C#

static void Main() {
  double a, b;

  Console.Write("Enter a number: ");
  a = Double.Parse(Console.ReadLine());

  b = a * a;

  Console.Write("The square of " + a + " is " + b);
  Console.ReadKey();
}

Visual Basic

Sub Main()
  Dim a, b As Double

  Console.Write("Enter a number: ")
  a = Console.ReadLine()

  b = a ^ 2

  Console.Write("The square of " & a & " is " & b)

  Console.ReadKey()
End Sub

Python

a = int(input("Enter a number: "))
b = a ** 2
print("The square of", a, "is", b)