i wanted to display a pattern like this
4444
333
22
1
i used the following code
import java.util.*;
public class PatternExp
{
public static void main (String args[])
{
Scanner src=new Scanner(System.in);
System.out.println("Enter the number of lines needed");
int n=src.nextInt();
for (int i=n; i>0; i--)
{ for(int j=n; j>0; j--)
{System.out.print(i+" ");}
System.out.println();}
}
}
but got an output like
4444
3333
2222
1111
what alterations should be done in the code???
Please reply