当前位置:网站首页>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
5
sample 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");
}
}
边栏推荐
- How to make recv have a little temper?
- How to understand the gain bandwidth product operational amplifier gain
- Report on prospects and future investment recommendations of China's assisted reproductive industry, 2022-2028 Edition
- 股票開戶傭金最低的券商有哪些大家推薦一下,手機上開戶安全嗎
- Minimum commission for stock account opening. Stock account opening is free. Is online account opening safe
- Pyqt5 sensitive word detection tool production, operator's Gospel
- 2022 free examination questions for hoisting machinery command and hoisting machinery command theory examination
- Subgraph isomorphism -subgraph isomorphism
- Gossip about redis source code 81
- Common mode interference of EMC
猜你喜欢
Schematic diagram of crystal oscillator clock and PCB Design Guide
China standard gas market prospect investment and development feasibility study report 2022-2028
Briefly understand the operation mode of developing NFT platform
Idea set class header comments
2022 chemical automation control instrument examination content and chemical automation control instrument simulation examination
X Opencv feature point detection and matching
Yyds dry goods inventory three JS source code interpretation - getobjectbyproperty method
How to write a good title of 10w+?
Ningde times and BYD have refuted rumors one after another. Why does someone always want to harm domestic brands?
EPF: a fuzzy testing framework for network protocols based on evolution, protocol awareness and coverage guidance
随机推荐
Current detection circuit - including op amp current scheme
Correlation analysis summary
Tencent interview: can you pour water?
How can I get the Commission discount of stock trading account opening? Is it safe to open an account online
How will the complete NFT platform work in 2022? How about its core functions and online time?
Gossip about redis source code 77
Collation of the most complete Chinese naturallanguageprocessing data sets, platforms and tools
Recursive least square adjustment
Smart fan system based on stm32f407
Selenium library 4.5.0 keyword explanation (III)
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
D24:divisor and multiple (divisor and multiple, translation + solution)
Gossip about redis source code 79
Learning methods of zynq
股票开户最低佣金炒股开户免费,网上开户安全吗
Gossip about redis source code 82
2022.02.13
A method to solve Bert long text matching
2020.2.14
Maxwell equation and Euler formula - link