Write a statement that reads 5 successive integers into these variables that have already been declared : x1 x2x3x4 x5. then write a statement that prints each out on its own line so that they form a right-justified column with a 5-digit width. if any of the integers are 5-digits in size, then they will start at the very beginning of their lines. for example: |54213| 8713| 23| 147| 15cin > > x1 > > x2 > > x3 > > x4 > > x5; cout < < setw(5) < < right < < x1 < < "\n"; cout < < setw(5) < < right < < x2 < < "\n"; cout < < setw(5) < < right < < x3 < < "\n"; cout < < setw(5) < < right < < x4 < < "\n"; cout < < setw(5) < < right < < x5 < < "\n";

Respuesta :

Answer:

The solution code is written in C++

  1.    int x1, x2, x3, x4, x5;
  2.    cin >> x1 >> x2 >> x3 >> x4 >> x5;
  3.    printf("|%5d|%5d|%5d|%5d|%5d", x1, x2, x3, x4, x5);

Explanation:

Given the five variables that have already been declared (Line 1). We use cin to read five integers and assign them to x1, x2, x3, x4 and x5, respectively (Line 2).

Next, we can use format specifier %5d to form a right justified 5-digit (Line 3). The keyword d denotes the printed number is for an integer.