vendredi 17 avril 2020

How to make this java triangle pattern? [closed]

* * * * 
  * * * 
    * * 
      * 

I tried making this pattern using nested for loops but failed to do so when i saw the solution to it they were using 2(n-i) formula in the inner loop

is there any alternative?

package Practise;
import java.util.Scanner;
public class practise {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

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

            for(;;) {



            }
        }




        }
}

I don't know what to do further please help.

Aucun commentaire:

Enregistrer un commentaire