当前位置:网站首页>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+' ')边栏推荐
- Prototypical Networks for Few-shot Learning
- Compatible with Internet Explorer
- Create an environment for new projects
- SRC platform summary
- February 19 CTF exercise
- Redis (17)
- IronOCR 2022.1 Crack
- In depth understanding of line height and vertical align
- Mobile number regular expression input box loses focus verification
- Eyeshot Ultimate 2022 Crack By Xacker
猜你喜欢

Virtual honeypot Honeyd installation and deployment
![H5 canvas drawing circle drawing fillet [detailed explanation]](/img/6f/a33a323b6cd0918066e8b71a22d841.jpg)
H5 canvas drawing circle drawing fillet [detailed explanation]

Leader: who can use redis expired monitoring to close orders and get out of here!

ThinkPHP 5 log management

Five simple data types of JS

What is Ethernet and how to connect the computer

buuctf web

Method of opening data recovery of solid state disk

TX Text Control 30.0 ActiveX

Penetration test - directory traversal vulnerability
随机推荐
Eyeshot 2022 Released
The construction and usage of wampserver framework
buuctf(pwn)
Filter & listener (XIV)
Difference between asemi high power FET and triode
Go deep into the working principle of browser and JS engine (V8 engine as an example)
Matlab notes
Customize the console plot result style
Various pits encountered in the configuration of yolov3 on win10
Student achievement management system based on SSH
OLAP analysis engine kylin4.0
API interface management setup -eolinker4.0
Native JS high risk reminder pop-up code snippet, "are you sure you want to do this?" and "it cannot be recovered after deletion. Do you want to continue“
Detailed summary of position positioning
Penetration information collection steps (simplified version)
以太网是什么要怎么连接电脑
Use serialize in egg to read and write split tables
Cookie & session & JSP (XII)
PHP uses JWT
ASEMI大功率场效应管和三极管的区别