Exercise
Rectangle
Objetive
Write a java program to ask the user for a number and then display a rectangle 3 columns wide and 5 rows tall using that digit. For example:
Enter a digit: 3
333
3 3
3 3
3 3
333
Example Code
import java.util.*;
public class Main
{
public static void main(String[] args)
{
int x;
System.out.print("Enter a number: ");
x = Integer.parseInt(new Scanner(System.in).nextLine());
System.out.printf("%1$s%1$s%1$s" + "\r\n", x);
System.out.printf("%1$s %1$s" + "\r\n", x);
System.out.printf("%1$s %1$s" + "\r\n", x);
System.out.printf("%1$s %1$s" + "\r\n", x);
System.out.printf("%1$s%1$s%1$s" + "\r\n", x);
}
}