当前位置:网站首页>1214 print diamond
1214 print diamond
2022-07-03 23:56:00 【Zhanglilong 666】
Title Description
Print out a symbol “*” A diamond pattern made up of .Input requirements
Enter an integer n( Odd number ), Represents the number of rows in a diamond .
Output requirements
Diamond character * Express , Spaces without suffixes on each line .
sample input
5sample output
* *** ***** *** *
#include<cstdio>
#include<math.h>
int main(){
int n,x,y,i,j,zll=0,p=1;
scanf("%d",&x);
zll=x/2;
for(i=1;i<=x/2;++i){// The first i That's ok .
for(j=1;j<=zll+1-i;j++){// The first j Column .
printf(" ");
}
for(j=1;j<=p;j++){// The first j Column .
printf("*");
}
p+=2;// Odd number , Add... Once in a cycle 2.
printf("\n");
}
for(i=1;i<=x;++i){// The first x That's ok .
printf("*");
}
printf("\n");
p-=2;
for(i=1;i<=x/2;i++){// The first i That's ok .
for(j=1;j<=i;j++){// The first j Column .
printf(" ");
}
for(j=1;j<=p;j++){// The first j Column .
printf("*");
}
p-=2;// Odd number , Cycle one subtraction 2.
printf("\n");
}
}边栏推荐
- Sword finger offer day 4 (Sword finger offer 03. duplicate numbers in the array, sword finger offer 53 - I. find the number I in the sorted array, and the missing numbers in sword finger offer 53 - ii
- Unity elementary case notes of angry birds Siki college 1-6
- Selenium library 4.5.0 keyword explanation (I)
- Fluent learning (4) listview
- Tencent interview: can you pour water?
- Ningde times and BYD have refuted rumors one after another. Why does someone always want to harm domestic brands?
- Is user authentication really simple
- It is forbidden to splice SQL in code
- 2022 a special equipment related management (elevator) examination questions and a special equipment related management (elevator) examination contents
- The difference between single power amplifier and dual power amplifier
猜你喜欢

2022.02.13

Private project practice sharing populate joint query in mongoose makes the template unable to render - solve the error message: syntaxerror: unexpected token r in JSON at

Double efficiency. Six easy-to-use pychar plug-ins are recommended

Vscode regular match replace console log(.*)

Unity shader visualizer shader graph

Fluent learning (4) listview
![[MySQL] classification of multi table queries](/img/96/2e51ae8d52ea8184945e0540ce18f5.jpg)
[MySQL] classification of multi table queries

Smart fan system based on stm32f407

How to make recv have a little temper?

Similarities and differences of text similarity between Jaccard and cosine
随机推荐
NLP pre training technology development
Analysis on the scale of China's smart health industry and prediction report on the investment trend of the 14th five year plan 2022-2028 Edition
P3371 [template] single source shortest path (weakened version)
Gossip about redis source code 78
D25:sequence search (sequence search, translation + problem solving)
Pandaoxi's video
Ningde times and BYD have refuted rumors one after another. Why does someone always want to harm domestic brands?
Ningde times and BYD have refuted rumors one after another. Why does someone always want to harm domestic brands?
NLP Chinese corpus project: large scale Chinese natural language processing corpus
C # basic knowledge (3)
Ramble 72 of redis source code
How to quickly build high availability of service discovery
Recursive least square adjustment
What are the securities companies with the lowest Commission for stock account opening? Would you recommend it? Is it safe to open an account on your mobile phone
How will the complete NFT platform work in 2022? How about its core functions and online time?
The interviewer's biggest lie to deceive you, bypassing three years of less struggle
STM32 GPIO CSDN creative punch in
Apple released a supplementary update to MacOS Catalina 10.15.5, which mainly fixes security vulnerabilities
Version rollback revert don't reset better reset must be forced
[2021]NeRF in the Wild: Neural Radiance Fields for Unconstrained Photo Collections