Number Pattern 1
Send Feedback
Print the following pattern for the given N number of rows.
Pattern for N = 4
Input format :
Output format :
Sample Input :
Sample Output :
import java.util.Scanner;
public class Main
{
public static void main(String[] args)
{
int i,j;
Scanner s=new Scanner(System.in);
int n = s.nextInt();
for(i=1;i<=n;i++)
{
for(j=1;j<=i;j++)
{
System.out.print("1");
}
System.out.println();
}
}
}
No comments:
Post a Comment