Tuesday, 1 March 2016

Types of pyramid programs pattern 12



Program
class Main{
public static void main(String args[]){
int i,j;
for(i=1;i<=5;i++){
for(j=i;j<=5;j++)
System.out.print(" "+j);
System.out.println(" ");
}
}
}

OUTPUT:-

C:\Users\Saty\Desktop\java>javac 1.java
C:\Users\Saty\Desktop\java>java Main
 1 2 3 4 5
 2 3 4 5
 3 4 5
 4 5
 5

No comments:

Post a Comment