当前位置:网站首页>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+' ')边栏推荐
- Customize the console plot result style
- ORA-00800: soft external error
- The SQL response is slow. What are your troubleshooting ideas?
- great! Auto like, I use pyautogui!
- XML (VIII)
- Get to know the drawing component of flutter - custompaint
- Why does the SQL statement hit the index faster than it does not?
- How PHP gets the user's City
- Startup mode of SoC verification environment
- Ranorex Studio 10.1 Crack
猜你喜欢

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

Startup mode of SoC verification environment

Go deep into the working principle of browser and JS engine (V8 engine as an example)

Attack and defense world web baby Web

Introduction to the hardest core PWN in the whole network_ Graphic analysis

Virtual honeypot Honeyd installation and deployment

Difference between asemi high power FET and triode

Notes on non replacement elements in the line (padding, margin, and border)

win11蓝牙无法连接怎么办?win11蓝牙无法连接的解决方法

Eyeshot 2022 Released
随机推荐
dotnet-exec 0.4.0 released
Why does the SQL statement hit the index faster than it does not?
台式电脑连不上wifi怎么办
本轮压力测试下,DeFi协议们表现如何?
For in JS Of and for in
Méthode de récupération des données d'ouverture du disque dur à l'état solide
Small sample learning data set
Prototypical Networks for Few-shot Learning
Database overview
Working principle of asemi three-phase rectifier bridge
Mysql interactive_ Timeout and wait_ Timeout differences
Matlab notes
Virtual honeypot Honeyd installation and deployment
以太网是什么要怎么连接电脑
Qdebug June 2022
Eyeshot 2022 Released
Student achievement management system based on SSH
There is 404 in the laravel visit, except the home page is redirected; Index php
Codeforces Round #802 (Div. 2) C D
ASEMI三相整流桥的工作原理