JAVA program for triangle number pattern 9
This program is to print triangle number pattern 9 in JAVA.
1
23
345
4567
56789
If you need a dry run of the program or any other query, then kindly leave a comment in the comment box or mail me, I would be more than happy to help you.
Program
import java.util.*; class np9 { public static void main(String args[]) { int i,j,n,k; Scanner sc = new Scanner(System.in); System.out.println("Enter the no of lines"); n=sc.nextInt(); for(i=1;i<=n;i++) { k=i; for(j=1;j<=i;j++,k++) { System.out.print(k); } System.out.println(""); } } }