当前位置:网站首页>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+' ')边栏推荐
- Could not find “store“ in the context of “Connect(homePage)
- Using JS to realize the sidebar of life information network
- 小白一键重装官网下载使用方法
- Mobile number regular expression input box loses focus verification
- 基于Cortex-M3、M4的精准延时(系统定时器SysTick延时,可用于STM32、ADuCM4050等)
- CTFHUB SSRF
- epplus复制模板后打印区域变小的问题
- Get to know the drawing component of flutter - custompaint
- Heavy broadcast | phase shift method + mathematical principle derivation of multi frequency heterodyne + implementation
- A brief talk on media inquiry
猜你喜欢

Virtual honeypot Honeyd installation and deployment

How micro engine uploads remote attachments

What if win11 Bluetooth fails to connect? Solution of win11 Bluetooth unable to connect

Working principle of asemi three-phase rectifier bridge

Activereportsjs V3.0 comes on stage

渗透测试-目录遍历漏洞

《QDebug 2022年6月》

buuctf(re)

How to install the blue lake plug-in to support Photoshop CC 2017

渗透测试-提权专题
随机推荐
CTFHub-rce
Various pits encountered in the configuration of yolov3 on win10
Database low-end SQL query statement fragment
Using JS to realize the sidebar of life information network
Codeforces Round #802 (Div. 2) C D
【图像融合】基于matlab方向离散余弦变换和主成分分析图像融合【含Matlab源码 1907期】
Characteristics of ES6 arrow function
Abuse unlimited authorization -- is your address safe?
两小时带你进入软件测试行业风口(附全套软件测试学习路线)
hr竟主动给这位测试小姐姐涨工资,她是怎么做到的?
February 20ctf record
Bind simulation, key points of interpreting bind handwritten code [details]
Cookie & session & JSP (XII)
What is Ethernet and how to connect the computer
投资理财产品的年限要如何选?
Redis (17)
DOM document object model (I)
API interface management setup -eolinker4.0
SQL lab range explanation
IronOCR 2022.1 Crack