Find a diamond using a while loop!!! 10

Updated on technology 2024-05-24
13 answers
  1. Anonymous users2024-02-11

    Halo, with for will be written, while will not?

    int i,j,k;

    i=0;while(i<=3)

    j=0;while(j<=2-i)

    printf(" ");

    j++;k=0;

    while(k<2*i)

    printf("*");

    k++;printf("");

    i++;i=0;

    while(i<=2)

    j=0;while(j<=i)

    printf(" ");

    j++;k=0;

    while(k<4-2*i)

    printf("*");

    k++;printf("");

    i++;

  2. Anonymous users2024-02-10

    Looking at these familiar and unfamiliar **, it's a pity that I forgot it for a long time.

  3. Anonymous users2024-02-09

    I could have helped you.,It's a pity that it's useless to learn and forget about it.。。。

  4. Anonymous users2024-02-08

    What you realize is the seven elements!

    **:#include

    void main()

    while(k<=2*i-1)

    elsewhile (n<=15-2*i)

    printf("");

    i++;

  5. Anonymous users2024-02-07

    It's not possible to just use a while statement, at least a variable declaration statement must have one.

  6. Anonymous users2024-02-06

    # include

    # include

    void main()

    for(i=1;i<=2*n-1;i++)printf("*");

    printf("");

    for(a=1;a} The main consideration is to use a for loop to solve the problem, divide the diamond into two parts, print the first part first, and then print the second part.

  7. Anonymous users2024-02-05

    To learn the concept of arrays in the C language, print arrays through the for loop output.

  8. Anonymous users2024-02-04

    There are many ways to do this, and you can start with i=0! I am now a public class zuoye starting from 1

    for(int i=1;i<=4;i++) hopes that you can draw inferences and print live diamonds.

  9. Anonymous users2024-02-03

    I'm using "instead of spaces" here to illustrate. You can change " to " " "The second half of the triangle is left to you, you can imitate the writing of the upper half, if you can imitate the writing, it is also progress!

    **: Initialize n

    int n = 10;

    The upper half of the triangle.

    The number of times the loop is executed, and the number of rows that are printed.

    for(int i=1;ifor(..

  10. Anonymous users2024-02-02

    Look at the pattern:

    2 1 = 5-[(1)*(2)*2]-1 3 = 5-[(1)*(1)*2] 0 5 = 5-[(0)*2] 1 3 = 5-[(1)*2 ]2 1 = 5-[(2)*2] Therefore, the inner cycle is:

    for( i=-2 ; i<=2;i++

  11. Anonymous users2024-02-01

    It's the same as GW-basic.,There's also an 8-bit learning machine with this program.,I've used it before.,Now I forgot.,But to give you an idea.,It's VB.。

    private sub command1_click()for i = -4 to 4 step 2print string(abs(i) / 2, " ") &string(5 - abs(i), "*") &string(abs(i) / 2, " ")

    next i

    end sub

    The bottom is written in basic, I don't know if it's right, 10 let str$="There are seven spaces in this one"

    20 let str1="***"

    30 for i=-4 to 4 step 240 print left$(str,abs(i)/2)) left$(str1,5-abs(i)) left$(str,abs(i)/2)

    50 next i

  12. Anonymous users2024-01-31

    function printfile()

    for (var k = 1; k <= 2 * i - 1;k++) determines the number of * for each row.

    for (var i = 1; i <= num - 1;i++) determines the number of rows to be output.

    for (var k = 1; k <= 2 * num - 1 - 2 * i;k++) determines the number of * for each row.

    After the call, you are asked to enter the edge length, and after the input, a diamond will appear.

    Call **:p rintfile();

  13. Anonymous users2024-01-30

    var num = 13;

    var num1 = -num+1;

    var stemp = 2;

    var str = "";

    for(var i=num1;istr+="";}

    I have a feeling that this is probably what you want.

Related questions
4 answers2024-05-24

The lines of the textbook play "Wu Song Fights the Tiger" are as follows: >>>More

21 answers2024-05-24

Depending on how much you buy, MX500, MX510, IE3 are high-end mice. >>>More

6 answers2024-05-24

Chinese spelling of rebecca: Rebecca, Description: Originally from the Hebrew word ribkah, meaning"Knotted ropes", to use it as a metaphor"Faithful wife"。 >>>More

24 answers2024-05-24

Ten years of life and death, Hengyuanxiang, sheep and sheep. Thousands of miles of lonely graves, laundry detergent with strange strength. Even if you don't know each other, supplement vitamin C, Shierkang. >>>More

5 answers2024-05-24

bool f=0;

for(int i=1000;i>=1;i--) Start with the largest number of 1000 and try to the smaller number. >>>More