Triangle - Right Justified Draw right angled triangle of given height Sample input: 4 Sample output
**
Hint: Count and print appropriate number of spaces in front of stars. Notice that there is one less space and one more star in each line.
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package BASICJAVA;
import java.util.Scanner;
/**
*
* @author ABIR
*/
public class Triangle_Right_Justified_Star {
public static void main(String[]args){
Scanner abir=new Scanner(System.in);
System.out.println("Enter sample input");
int x=abir.nextInt();
System.out.println("sample output");
int c=0;
while(c<x){
int d=0;
while(d<x-(c+1)){
System.out.print(" ");
d++;
}
int e=0;
while(e<=c){
System.out.print("*");
e++;
}
System.out.println();
c++;
}
System.out.println("=======================================================");
}
}