current position:Home>Double for cyclic printing * square matrix

Double for cyclic printing * square matrix

2022-02-04 16:58:40 CSDN Q & A

img




Take the answer :

It is recommended to try to write the code first , It doesn't matter if it's incorrect , Post the code and errors you tried , Then others can help you analyze and discuss .



Other answers 2:
  1. This first look rule , Each time more than the next line 2 individual Or less 2 individual
  2. Follow your own ideas , The general process should have .
  3. I'm a vegetable, too ,java Not so much , But the process is as follows , This is the of the first graph , In the second figure, just change the conditions
for(int i=1;i<=n;i++)// Lines {   for(int j = 1; j<=2*i-1; j++)// Output several *  {    printf("*");  }  printf("\n");// Wrap at the end of each line }

Other answers 3:
public class test {    public static void main(String[] args) {        for (int i = 1; i < 5; i++) {            for (int j = 0; j <2*i-1 ; j++) {                System.out.print("*");            }            System.out.println();        }        System.out.println("---------------");        for (int i = 4; i >0 ; i--) { 
                for (int j = 0; j <2*i-1 ; j++) {                System.out.print("*");            }            System.out.println();        }            }}

img

img

copyright notice
author[CSDN Q & A],Please bring the original link to reprint, thank you.
https://en.cdmana.com/2022/02/202202041658377728.html

Random recommended