Drawing Isosceles Triangle of A Given Height Using Java

hey everyone so i tried write a code on drawing isosceles. if you have any easier ways to solve it do let me know…

import java.util.Scanner;
public class task{
public static void main(String args[]){
Scanner anik = new Scanner(System.in);
System.out.println(“give a line number”);
int fnum = anik.nextInt();
int b = fnum;
for(int count = 1; count <= fnum; ++count){ for(int xcount = 1; xcount < b; ++xcount){ System.out.print(" "); } for(int tcount =1; tcount <= count; ++tcount){ System.out.print("*"); } System.out.println(""); b--; } } }

Leave a Reply

Your email address will not be published. Required fields are marked *