sujana-kamasany / javacodes

A repository that will guide in making your first contribution.
30 stars 109 forks source link

inverted pyramid using * and digits #59

Open sujana-kamasany opened 2 years ago

sujana-kamasany commented 2 years ago

Add Java Program to print inverted pyramid using * and digits

image

DHARUNKUMAR7 commented 2 years ago

My ans: public class Main { public static void main(String[] args) throws Exception { Scanner in = new Scanner(System.in); int a = in.nextInt(); for(int i = 0 ; i < a; i++){ for(int j = 0 ; j < i ;j++){ System.out.print(" "); } for (int j = 0; j < a - i; j++) { System.out.print(" "); } for (int j = 0; j < a - 1 - i; j++) { System.out.print(" "); } System.out.println(); } } }

sujana-kamasany commented 2 years ago

@DHARUNKUMAR7 thank you for the code! please go ahead and make a pull request