Number Pattern 4
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)
{
Scanner s = new Scanner(System.in);
int n = s.nextInt();
for(int i=1,r=n;i<=n;i++,r--)
{
for(int j=1;j<=r;j++)
{
System.out.print(j);
}
System.out.println();
}
}
}
No comments:
Post a Comment