java asterisk right triangle

前端 未结 5 1226
星月不相逢
星月不相逢 2020-12-11 11:56

I\'d like to try a right triangle asterisk. But I only got this output: (I can\'t place here the asterisk)

@ 
@@
@@@

what

5条回答
  •  北海茫月
    2020-12-11 12:49

    Try the following:

    import java.io.*;
    public class Star2 {
    
        public static void main(String[] args)throws IOException {
    
            InputStreamReader read = new InputStreamReader(System.in);
            BufferedReader in = new BufferedReader(read);
            int i,j,n=0,k;
            System.out.print("How many stars you want to print in first row ? ");
            n=Integer.parseInt(in.readLine());
            for (i = 0; i

提交回复
热议问题