当前位置:网站首页>Exercise 9-1 time conversion
Exercise 9-1 time conversion
2022-07-03 14:09:00 【ᯤ⁹ᴳ⁺ ·】
exercises 9-1 Time conversion (15 branch )
This question requires the preparation of procedures , With hh:mm:ss
Output in the format of... After a given time n
Time value after seconds ( exceed 23:59:59 From 0 The clock starts at ).
Input format :
Enter in the first line with hh:mm:ss
The format of gives the start time , The second line gives the number of whole seconds n
(<60).
Output format :
The output is given on one line hh:mm:ss
Result time in format .
sample input :
11:59:40
30
sample output :
12:00:10
Code
#include<stdio.h>
int main(){
int h,m,s,n;
scanf("%d:%d:%d",&h,&m,&s);
scanf("%d",&n);
if(s+n>=60){
m++;
s+=n-60;
}else{
s+=n;
}
if(m>=60){
h++;
m-=60;
}
if(h>=24){
h-=24;
}
printf("%02d:%02d:%02d",h,m,s);
return 0;
}
边栏推荐
- Simulated access
- Dynamic programming 01 knapsack and complete knapsack
- Message subscription and publishing
- Go language web development series 27: Gin framework: using gin swagger to implement interface documents
- 金属有机骨架(MOFs)抗肿瘤药载体|PCN-223装载甲硝唑|UiO-66包载盐酸环丙沙星([email protected])
- Page generation QR code
- Go 1.16.4: purpose of go mod tidy
- [technology development-24]: characteristics of existing IOT communication technology
- Qt学习17 对话框及其类型
- How to delete an attribute or method of an object
猜你喜欢
[email protected] Nanoparticles) | nano metal organic framework carry"/>
Metal organic framework material zif-8 containing curcumin( [email protected] Nanoparticles) | nano metal organic framework carry
Article content typesetting and code highlighting
UiO-66-COOH装载苯达莫司汀|羟基磷灰石( HA) 包裹MIL-53(Fe)纳米粒子|装载黄芩苷锰基金属有机骨架材料
Redis: commandes d'action pour les données de type chaîne
Example analysis of QT learning 18 login dialog box
交联环糊精金属有机骨架负载甲氨蝶呤缓释微粒|金属-有机多孔材料UiO-66负载黄酮苷类药物|齐岳
GoLand 2021.1: rename the go project
Qt学习22 布局管理器(一)
Scroll detection, so that the content in the lower right corner is not displayed at the top of the page, but is displayed as the mouse slides
Go language web development series 25: Gin framework: using MD5 to verify the signature for the interface station
随机推荐
[bw16 application] instructions for firmware burning of Anxin Ke bw16 module and development board update
How to delete an attribute or method of an object
[understanding by chance-37]: the structure of human sensory system determines that human beings are self-centered
金属有机骨架MIL-88负载阿霉素DOX|叶酸修饰UiO-66-NH2负载阿霉素[email protected]纳米粒子
Cross linked cyclodextrin metal organic framework loaded methotrexate slow-release particles | metal organic porous material uio-66 loaded with flavonoid glycosides | Qiyue
Go language web development series 27: Gin framework: using gin swagger to implement interface documents
JVM垃圾回收机
GoLand 2021.1.1: configure the multi line display of the tab of the open file
QT learning 24 layout manager (III)
Onmenusharetimeline custom shared content is invalid, and the title and icon are not displayed
Why are grass-roots colleges and universities with "soil and poverty" called "Northeast small Tsinghua"?
QT learning 23 layout manager (II)
Implementation of Muduo asynchronous logging
Qt学习17 对话框及其类型
金属有机骨架MOFs装载非甾体类抗炎药物|ZIF-8包裹普鲁士蓝负载槲皮素(制备方法)
Redis: operation command of string type data
Comprehensive case of MySQL data addition, deletion, modification and query
Go language web development series 29: Gin framework uses gin contrib / sessions library to manage sessions (based on cookies)
[combinatorics] permutation and combination (two counting principles, examples of set permutation | examples of set permutation and circle permutation)
Go: send the get request and parse the return JSON (go1.16.4)