Output:
Click Here For Java Online Compiler
Solution:
Enter the number of rows: 8 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 1 1 1 1 1 3 3 3 1 1 1 1 4 4 4 4 1 1 1 5 5 5 5 5 1 1 6 6 6 6 6 6 1 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8
Click Here For Java Online Compiler
Solution:
import java.util.Scanner; class NumberPattern9 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.print("Enter the number of rows: "); int base = scanner.nextInt(); System.out.println(); int num = 1; for (int b = base; b > 0; b--) { for (int a = b - 1; a > 0; a--) { System.out.print("1 "); } for (int c = num; c <= num; c++) { for (int d = 1; d <= c; d++) { System.out.print(c + " "); } System.out.println(); } num++; } } }
comment 1 comments:
more_vertReally Nice Post to Print Star Pattern in Java Yesterday I visit this blog and i was found lots of helpful information from your side thanks for sharing updated and New Technology related Post.
3 May 2018 at 09:59sentiment_satisfied Emoticon