当前位置:网站首页>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;
}
边栏推荐
- Uio-66-cooh loaded bendamostine | hydroxyapatite (HA) coated MIL-53 (FE) nanoparticles | baicalin loaded manganese based metal organic skeleton material
- JS input number and standard digit number are compared. The problem of adding 0 to 0
- Configure stylelint
- Nucleic acid modified metal organic framework drug carrier | pcn-223 metal organic framework encapsulated ad adamantane | zif-8 encapsulated adriamycin (DOX)
- JVM系列——概述,程序计数器day1-1
- Conversion function and explicit
- Qt学习20 Qt 中的标准对话框(中)
- Implementation of Muduo asynchronous logging
- Function calling convention
- Qt学习17 对话框及其类型
猜你喜欢
![[bw16 application] instructions for firmware burning of Anxin Ke bw16 module and development board update](/img/b8/31609303fd817c48b6fff7c43f31e5.png)
[bw16 application] instructions for firmware burning of Anxin Ke bw16 module and development board update

jvm-运行时数据区
[email protected](Fe)|甘草次酸修饰金属有机框架材料UiO-66-NH2(简称UiO-66-NH2-GA)"/>MIL-100( Fe) 包裹小分子阿司匹林形成[email protected](Fe)|甘草次酸修饰金属有机框架材料UiO-66-NH2(简称UiO-66-NH2-GA)

全局事件总线

The small project (servlet+jsp+mysql+el+jstl) completes a servlet with login function, with the operation of adding, deleting, modifying and querying. Realize login authentication, prevent illegal log

交联环糊精金属有机骨架负载甲氨蝶呤缓释微粒|金属-有机多孔材料UiO-66负载黄酮苷类药物|齐岳
[email"/>Folic acid modified metal organic framework (zif-8) baicalin loaded metal organic framework composite magnetic material (AU- [email

Implementation of Muduo asynchronous logging

Spring cup eight school league

Message subscription and publishing
随机推荐
Golang — template
可编程逻辑器件软件测试
JVM系列——概述,程序计数器day1-1
Qt学习25 布局管理器(四)
Comprehensive case of MySQL data addition, deletion, modification and query
核酸修饰的金属有机框架药物载体|PCN-223金属有机骨架包载Ad金刚烷|ZIF-8包裹阿霉素(DOX)
JVM runtime data area
Webpage connection database ~ simple implementation of addition, deletion, modification and query complete code
使用vscode查看Hex或UTF-8编码
[Jilin University] information sharing of postgraduate entrance examination and re examination
Duet date picker (time plug-in that can manually enter the date)
TS code automatically generates JS
1px problem of mobile terminal
Conversion function and explicit
Solve the problem of dormitory router campus network sharing login
QT learning 20 standard dialog box in QT (middle)
page owner特性浅析
FPGA测试方法以Mentor工具为例
Spring cup eight school league
Cross linked cyclodextrin metal organic framework loaded methotrexate slow-release particles | metal organic porous material uio-66 loaded with flavonoid glycosides | Qiyue