当前位置:网站首页>Electronic Society C language level 1 28, character diamond
Electronic Society C language level 1 28, character diamond
2022-06-25 05:08:00 【dllglvzhenfeng】
Electronics Association C Language 1 level 28 、 Character diamond
OpenJudge - 09: Character diamond
C The language code :
/*
Electronics Association C Language 1 level 28 、 Character diamond
http://noi.openjudge.cn/ch0101/09/
Given a character , Use it to construct a diagonal length 5 Characters , A diamond placed obliquely .
Input : There is only one line of input , Contains one character .
Output
This character forms a diamond .
The sample input
*
Sample output
*
***
*****
***
*
*/
#include <stdio.h>
#include <stdlib.h>
int main()
{
char ch;
// Given a character ,
scanf("%c",&ch);
// Use it to construct a diagonal length 5 Characters , A diamond placed obliquely .
printf(" %c\n",ch);
printf(" %c%c%c\n",ch,ch,ch);
printf("%c%c%c%c%c\n",ch,ch,ch,ch,ch);
printf(" %c%c%c\n",ch,ch,ch);
printf(" %c\n",ch);
return 0;
}C++ Code :
/*
Electronics Association C Language 1 level 28 、 Character diamond
http://noi.openjudge.cn/ch0101/09/
Given a character , Use it to construct a diagonal length 5 Characters , A diamond placed obliquely .
Input : There is only one line of input , Contains one character .
Output
This character forms a diamond .
The sample input
*
Sample output
*
***
*****
***
*
*/
#include<iostream> // Use cin,cout, Must be invoked iostream library
using namespace std;
int main()
{
char a; // Defining character variables ,
cin>>a; // Enter a given character
cout<<" "<<a<<endl; // Output 1 Characters , First, the output 2 A space
cout<<" "<<a<<a<<a<<endl; // Output 3 Characters , First, the output 1 A space
cout<<a<<a<<a<<a<<a<<endl; // Output 5 Characters
cout<<" "<<a<<a<<a<<endl; // Output 3 Characters , First, the output 1 A space
cout<<" "<<a<<endl; // Output 1 Characters , First, the output 2 A space
return 0; // End procedure
}python3 Code :
a = input()
print(' '+a+' ')
print(' '+a+a+a+' ')
print(a+a+a+a+a)
print(' '+a+a+a+' ')
print(' '+a+' ')边栏推荐
- ORA-00800: soft external error
- JS function to realize simple calculator
- Abuse unlimited authorization -- is your address safe?
- 以太网是什么要怎么连接电脑
- Wechat applet new version prompt update
- 投资理财产品的年限要如何选?
- For in JS Of and for in
- MySQL concept and operation (III)
- Basic knowledge of web pages (URL related)
- H5 canvas drawing circle drawing fillet [detailed explanation]
猜你喜欢

Compatible with Internet Explorer

WPF uses Maui's self drawing logic

小白一键重装官网下载使用方法

EL & JSTL (XIII)

DOM document object model (I)

Startup mode of SoC verification environment

Install pytorch through pip to solve the problem that torch cannot be used in jupyter notebook (modulenotfoundererror:no module named 'Torch').

魔法猪系统重装大师怎么使用

Use serialize in egg to read and write split tables

Virtual honeypot Honeyd installation and deployment
随机推荐
融合CDN,为客户打造极致服务体验!
Object creation and invocation code example
2021-10-24
Flex flexible layout for mobile terminal page production
olap分析引擎——Kylin4.0
On Transform
Google Earth Engine(GEE)——全球JRC/GSW1_1/YearlyHistory数据集的批量下载(中国区域)
February 20ctf record
Web3 DAPP user experience best practices
The print area becomes smaller after epplus copies the template
Edge loss 解读
JDBC (IV)
H5 canvas drawing circle drawing fillet [detailed explanation]
Kotlin compose listens to the soft keyboard and clicks enter to submit the event
固态硬盘开盘数据恢复的方法
OLAP analysis engine kylin4.0
Filter & listener (XIV)
great! Auto like, I use pyautogui!
电脑的dwg文件怎么打开
Precise delay based on Cortex-M3 and M4 (systick delay of system timer can be used for STM32, aducm4050, etc.)