-
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++;
-
Looking at these familiar and unfamiliar **, it's a pity that I forgot it for a long time.
-
I could have helped you.,It's a pity that it's useless to learn and forget about it.。。。
-
What you realize is the seven elements!
**:#include
void main()
while(k<=2*i-1)
elsewhile (n<=15-2*i)
printf("");
i++;
-
It's not possible to just use a while statement, at least a variable declaration statement must have one.
-
# 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.
-
To learn the concept of arrays in the C language, print arrays through the for loop output.
-
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.
-
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(..
-
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++
-
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
-
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();
-
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.
The lines of the textbook play "Wu Song Fights the Tiger" are as follows: >>>More
Depending on how much you buy, MX500, MX510, IE3 are high-end mice. >>>More
Chinese spelling of rebecca: Rebecca, Description: Originally from the Hebrew word ribkah, meaning"Knotted ropes", to use it as a metaphor"Faithful wife"。 >>>More
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
bool f=0;
for(int i=1000;i>=1;i--) Start with the largest number of 1000 and try to the smaller number. >>>More