/*
* Autor: Juan Antonio Ripoll
* Date: 30/10/13
*
* 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
* */
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.print("Enter a digit: ");
int digit = in.nextInt();
for (int row=0;row<5;row++)
{
for (int column=0;column<3;column++)
{
if (row == 0 || row == 4)
System.out.print(digit);
else
{
if (column == 1)
System.out.print(" ");
else
System.out.print(digit);
}
}
System.out.println();
}
}
}
Wednesday, October 30, 2013
1.13 - Rectangle
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment