Output:
Click Here For Java Online Compiler
Solution:
Enter the number of rows: 9 1 1 2 1 2 3 1 2 3 4 1 2 3 4 5 1 2 3 4 5 6 1 2 3 4 5 6 7 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 9
Click Here For Java Online Compiler
Solution:
import java.util.Scanner; class NumberPattern1 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.print("Enter the number of rows: "); int base = scanner.nextInt(); int it = 1; for (int a = 1; a <= base; a++) { for (it = 1; it <= a; it++) { System.out.print(it + " "); } System.out.println(); } } }
comment 1 comments:
more_vertnice article.thank you for sharing useful info.
29 August 2018 at 20:11visit
web programming tutorial
welookups
sentiment_satisfied Emoticon