当前位置:网站首页>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+' ')边栏推荐
- JDBC (IV)
- Google Earth engine (GEE) - Global jrc/gsw1_ 1 / batch download of yearlyhistory dataset (China region)
- Apache+php uploading large files
- XML (VIII)
- Laravel Aurora push
- Object creation and invocation code example
- Cookie & session & JSP (XII)
- EL & JSTL (XIII)
- ASEMI三相整流桥的工作原理
- [keil] GPIO output macro definition of aducm4050 official library
猜你喜欢

XSS (cross site script attack) summary (II)

《QDebug 2022年6月》

以太网是什么要怎么连接电脑

Difference between asemi high power FET and triode

olap分析引擎——Kylin4.0

Ranorex Studio 10.1 Crack

PHP calls map API

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

buuctf web

Five simple data types of JS
随机推荐
CTFHUB SSRF
dotnet-exec 0.4.0 released
For in JS Of and for in
win11蓝牙无法连接怎么办?win11蓝牙无法连接的解决方法
基于SSH实现的学生成绩管理系统
olap分析引擎——Kylin4.0
2021-04-02
The SQL response is slow. What are your troubleshooting ideas?
Filter & listener (XIV)
Use js to simply implement the apply, call and bind methods
Even if you are not good at anything, you are growing a little bit [to your 2021 summary]
SQL lab range explanation
Database low-end SQL query statement fragment
Difference between asemi high power FET and triode
Redis (17)
A review of small sample learning
buuctf(pwn)
What if the desktop computer is not connected to WiFi
Route parameters to jump to the page and transfer parameters -- > hidden parameter list
Understand JS high-order function and write a high-order function