当前位置:网站首页>7-7 12-24 hour system
7-7 12-24 hour system
2022-07-03 14:09:00 【ᯤ⁹ᴳ⁺ ·】
7-7 12-24 hourly (15 branch )
Write a program , Ask the user to enter 24 Hours of time , Then show 12 Hours of time .
Input format :
The input is given in one line with a middle : Symbol ( Half colon ) Of 24 Hours of time , Such as 12:34 Express 12 spot 34 branch . When the number of hours or minutes is less than 10 when , There are no leading zeros , Such as 5:6 Express 5 Zero 6 branch .
Tips : stay scanf Add... To the format string of :, Give Way scanf To handle this colon .
Output format :
Output the... Corresponding to this time in one line 12 Hours of time , The format of the number part is the same as that entered , Then follow the space , Then follow the string representing the morning AM Or a string representing the afternoon PM. Such as 5:6 PM In the afternoon 5 Zero 6 branch . Be careful , In the habit of English , At noon, 12 O'clock is considered to be afternoon , therefore 24 Hourly 12:00 Namely 12 Hourly 12:0 PM; and 0 The point is considered to be the time of the next day , So it is 0:0 AM.
sample input :
21:11
sample output :
9:11 PMCode :
#include<stdio.h>
int main(){
int h,m;
scanf("%d:%d",&h,&m);
if(h>12){
h=h-12;
printf("%d:%d PM",h,m);
}else if(h==12){
printf("%d:%d PM",h,m);
}else if(h==0){
printf("%d:%d AM",h,m);
}else{
printf("%d:%d AM",h,m);
}
return 0;
}
边栏推荐
- Failure of vector insertion element iterator in STL
- Rasp implementation of PHP
- Analysis of the characteristics of page owner
- page owner特性浅析
- Record 405 questions about bank callback post request
- Redis: redis data structure and key operation commands
- FPGA测试方法以Mentor工具为例
- Spring cup eight school league
- Use vscode to view hex or UTF-8 codes
- 项目协作的进度如何推进| 社区征文
猜你喜欢
[email protected])|制备路线"/>叶酸修饰的金属-有机骨架(ZIF-8)载黄芩苷|金属有机骨架复合磁性材料([email protected])|制备路线

Redis: commandes d'action pour les données de type chaîne

Current situation, analysis and prediction of information and innovation industry

GoLand 2021.1.1: configure the multi line display of the tab of the open file

Go language web development series 26: Gin framework: demonstrates the execution sequence of code when there are multiple middleware

Multi person collaborative data annotation based on Baidu brain easydata from scratch

QT learning 19 standard dialog box in QT (top)

从零开始的基于百度大脑EasyData的多人协同数据标注

Use and design of Muduo buffer class

Golang - command line tool Cobra
随机推荐
js . Find the first palindrome string in the array
Similarities and differences of sessionstorage, localstorage and cookies
核酸修饰的金属有机框架药物载体|PCN-223金属有机骨架包载Ad金刚烷|ZIF-8包裹阿霉素(DOX)
Thrift threadmanager and three monitors
项目协作的进度如何推进| 社区征文
Go 1.16.4: manage third-party libraries with Mod
Failure of vector insertion element iterator in STL
Go language web development series 28: solve cross domain access of CORS with gin contrib / CORS
How to bold text in AI
JVM垃圾回收机
Cross linked cyclodextrin metal organic framework loaded methotrexate slow-release particles | metal organic porous material uio-66 loaded with flavonoid glycosides | Qiyue
Onmenusharetimeline custom shared content is invalid, and the title and icon are not displayed
[combinatorics] permutation and combination (examples of combinatorial number of multiple sets | three counting models | selection problem | combinatorial problem of multiple sets | nonnegative intege
八大排序
QT learning 20 standard dialog box in QT (middle)
28: Chapter 3: develop Passport Service: 11: define attributes in the configuration file, and then obtain them in the code;
玖逸云黑免费无加密版本源码
JS input number and standard digit number are compared. The problem of adding 0 to 0
JS first summary
Doxorubicin loaded on metal organic framework MIL-88 DOX | folic acid modified uio-66-nh2 doxorubicin loaded [email