JAVA program for triangle number pattern 2
This program is to print triangle number pattern 2 in JAVA.
55555
4444
333
22
1
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 np2 { public static void main(String args[]) { int i,j,n; Scanner sc = new Scanner(System.in); System.out.println("Enter the no of lines"); n=sc.nextInt(); for(i=n;i>=1;i--) { for(j=1;j<=i;j++) { System.out.print(i); } System.out.println(""); } } }