How to make a diamond using Nested For Loops

后端 未结 15 1353
终归单人心
终归单人心 2021-01-01 07:09

So I was assigned to make a diamond with asterisks in Java and I\'m really stumped. Here\'s what I\'ve come up with so far:

public class Lab1 
{
   public s         


        
15条回答
  •  情深已故
    2021-01-01 07:54

    import java.util.Scanner;
    
    
    public class Diamond {
    
        /**
         * @param args
         */
        public static void main(String[] args) {
            // TODO Auto-generated method stub
            Scanner in=new Scanner(System.in);
            int input=in.nextInt();
            int min=1;
            for(int i=0;ii;j--){
                    System.out.print(" ");
                }
                for(int k=0;k

提交回复
热议问题