Monday, October 27, 2014

Print a with a straight vertical line to the left instead of the right.








How can I make this program print so the output looks like this ( ignore the - -- lines ):








--------1







-------21







-----321







---4321







-54321








Instead of:







1







21







321







4321







54321








Here is my code below.












Java Code:











public class c5e18c {
public static void main(String[]args){

int i;
int j;

for(i = 1; i<=6; i++){

for (j = i; j>=1 ;j--){
System.out.printf(j + " ");
}
System.out.println();
}

}









}










No comments:

Post a Comment