Previous Next
0 / 15
Module DEMO-33-67DEMO-OOP-33

Pattern Last Line

DEMO-OOP-33 โ€ข Object Oriented Programming

Browser-only practice

Problem Statement

Read the height of a star pattern and print the height together with the final line of the pattern.

Input Format

Input is given as whitespace-separated tokens in this order:

  1. pattern height

Output Format

Print the exact report in this order:

  1. Height
  2. Last Line

Sample Testcases

Submit runs every public testcase in this browser. Results and code never leave this device.

Sample #1
Public sample
3
Height: 3
Last Line: ***
Input: pattern height = 3.
Key calculation(s): lastLine = new StringBuilder() | for (int i = 0; i < 3; i++) { | "Height: " + 3 = "Height: 3".
Output:
Height: 3
Last Line: ***
Sample #2
Public sample
5
Height: 5
Last Line: *****
Input: pattern height = 5.
Key calculation(s): lastLine = new StringBuilder() | for (int i = 0; i < 5; i++) { | "Height: " + 5 = "Height: 5".
Output:
Height: 5
Last Line: *****

Web terminal

C, C++, Java, and Python run locally in a browser VM. No worker or visualizer is used.

Saved in this browser
Editor settings