当前位置:网站首页>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
30
sample 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;
}
边栏推荐
- QTreeView+自定义Model实现示例
- Basic data types in golang
- Golang Modules
- 智能网关助力提高工业数据采集和利用
- Hands on deep learning (37) -- cyclic neural network
- C language pointer interview question - the second bullet
- C # use gdi+ to add text to the picture and make the text adaptive to the rectangular area
- Write a jison parser from scratch (1/10):jison, not JSON
- Get the source code in the mask with the help of shims
- Nuxt reports an error: render function or template not defined in component: anonymous
猜你喜欢
PHP personal album management system source code, realizes album classification and album grouping, as well as album image management. The database adopts Mysql to realize the login and registration f
xxl-job惊艳的设计,怎能叫人不爱
技术管理进阶——如何设计并跟进不同层级同学的绩效
165 webmaster online toolbox website source code / hare online tool system v2.2.7 Chinese version
MySQL develops small mall management system
2022-2028 global gasket metal plate heat exchanger industry research and trend analysis report
C语言指针面试题——第二弹
pcl::fromROSMsg报警告Failed to find match for field ‘intensity‘.
Daughter love: frequency spectrum analysis of a piece of music
How can people not love the amazing design of XXL job
随机推荐
DR6018-CP01-wifi6-Qualcomm-IPQ6010-IPQ6018-FAMILY-2T2R-2.5G-ETH-port-CP01-802-11AX-MU-MIMO-OFDMA
2022-2028 global gasket plate heat exchanger industry research and trend analysis report
Mmclassification annotation file generation
pcl::fromROSMsg报警告Failed to find match for field ‘intensity‘.
lolcat
Golang Modules
Les différents modèles imbriqués de listview et Pageview avec les conseils de flutter
How can Huawei online match improve the success rate of player matching
In the case of easyUI DataGrid paging, click the small triangle icon in the header to reorder all the data in the database
7-17 crawling worms (15 points)
Luogu deep foundation part 1 Introduction to language Chapter 4 loop structure programming (2022.02.14)
2022-2028 global visual quality analyzer industry research and trend analysis report
Global and Chinese markets of thrombography hemostasis analyzer (TEG) 2022-2028: Research Report on technology, participants, trends, market size and share
Get the source code in the mask with the help of shims
Write a jison parser from scratch (5/10): a brief introduction to the working principle of jison parser syntax
直方图均衡化
Baidu R & D suffered Waterloo on three sides: I was stunned by the interviewer's set of combination punches on the spot
C language pointer interview question - the second bullet
Implementing expired localstorage cache with lazy deletion and scheduled deletion
Explanation of closures in golang