当前位置:网站首页>Exercise 9-1 time conversion (15 points)
Exercise 9-1 time conversion (15 points)
2022-07-04 09:46:00 【skeet follower】
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
30sample output :
12:00:10
The code is as follows :
#include<stdio.h>
int main()
{
int hour=0,minute=0,second=0,n;
scanf("%d:%d:%d",&hour,&minute,&second);
scanf("%d",&n);
second+=n;
if(second>=60){
minute++;
second-=60;
}
if(minute>=60){
hour++;
minute-=60;
}
if(hour>=24){
hour-=24;
}
printf("%02d:%02d:%02d",hour,minute,second);
return 0;
}边栏推荐
- lolcat
- Web端自动化测试失败原因汇总
- Hands on deep learning (39) -- gating cycle unit Gru
- 【leetcode】540. A single element in an ordered array
- 165 webmaster online toolbox website source code / hare online tool system v2.2.7 Chinese version
- Summary of small program performance optimization practice
- How can Huawei online match improve the success rate of player matching
- ASP. Net to access directory files outside the project website
- Write a jison parser from scratch (6/10): parse, not define syntax
- 2022-2028 global strain gauge pressure sensor industry research and trend analysis report
猜你喜欢

el-table单选并隐藏全选框

Machine learning -- neural network (IV): BP neural network

Matlab tips (25) competitive neural network and SOM neural network

品牌连锁店5G/4G无线组网方案

Qtreeview+ custom model implementation example

2022-2028 global protein confectionery industry research and trend analysis report

2022-2028 global probiotics industry research and trend analysis report

Summary of small program performance optimization practice

PHP is used to add, modify and delete movie information, which is divided into foreground management and background management. Foreground users can browse information and post messages, and backgroun

2022-2028 global gasket metal plate heat exchanger industry research and trend analysis report
随机推荐
Hands on deep learning (38) -- realize RNN from scratch
Summary of the most comprehensive CTF web question ideas (updating)
华为联机对战如何提升玩家匹配成功几率
2022-2028 global edible probiotic raw material industry research and trend analysis report
[on February 11, 2022, the latest and most fully available script library collection of the whole network, a total of 23]
Lauchpad X | 模式
Global and Chinese markets for laser assisted liposuction (LAL) devices 2022-2028: Research Report on technology, participants, trends, market size and share
libmysqlclient. so. 20: cannot open shared object file: No such file or directory
Kotlin:集合使用
Global and Chinese markets of hemoglobin analyzers in care points 2022-2028: Research Report on technology, participants, trends, market size and share
Machine learning -- neural network (IV): BP neural network
Hands on deep learning (33) -- style transfer
Kubernetes CNI 插件之Fabric
Multilingual Wikipedia website source code development part II
Get the source code in the mask with the help of shims
`Example of mask ` tool use
Hands on deep learning (35) -- text preprocessing (NLP)
libmysqlclient.so.20: cannot open shared object file: No such file or directory
Advanced technology management - how to design and follow up the performance of students at different levels
Global and Chinese trisodium bicarbonate operation mode and future development forecast report Ⓢ 2022 ~ 2027