Computer Science, asked by Anonymous, 1 year ago

program to print triangle
* * * * *
* * * *
* * *
* *
*
By Scanner method

Answers

Answered by nitish8089
2

public class Program

{

public static void main(String[] args) {

 for(int i=5;i>=1;i--){

     for(int j=1;j<=i;j++){

         System.out.print("*");

     }

     System.out.println();

 }

}

}


nitish8089: there is no need of Scanner method if you just want print this pattern
nitish8089: actually Scanner is class not a method ..
Similar questions