当前位置:网站首页>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;
}边栏推荐
- SQL replying to comments
- H5 audio tag custom style modification and adding playback control events
- Global and Chinese market of sampler 2022-2028: Research Report on technology, participants, trends, market size and share
- Hands on deep learning (44) -- seq2seq principle and Implementation
- libmysqlclient. so. 20: cannot open shared object file: No such file or directory
- 2022-2028 global protein confectionery industry research and trend analysis report
- About the for range traversal operation in channel in golang
- Nuxt reports an error: render function or template not defined in component: anonymous
- Multilingual Wikipedia website source code development part II
- 2022-2028 global visual quality analyzer industry research and trend analysis report
猜你喜欢

PHP student achievement management system, the database uses mysql, including source code and database SQL files, with the login management function of students and teachers

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

Hands on deep learning (42) -- bi-directional recurrent neural network (BI RNN)

2022-2028 global visual quality analyzer industry research and trend analysis report

2022-2028 global seeder industry research and trend analysis report

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 tensile strain sensor industry research and trend analysis report

Daughter love in lunch box

2022-2028 global probiotics industry research and trend analysis report

Hands on deep learning (40) -- short and long term memory network (LSTM)
随机推荐
2022-2028 global industrial gasket plate heat exchanger industry research and trend analysis report
How can people not love the amazing design of XXL job
Golang defer
Launpad | 基礎知識
Hands on deep learning (42) -- bi-directional recurrent neural network (BI RNN)
Latex download installation record
Explanation of for loop in golang
Report on the development trend and prospect trend of high purity zinc antimonide market in the world and China Ⓕ 2022 ~ 2027
Hands on deep learning (41) -- Deep recurrent neural network (deep RNN)
C # use ffmpeg for audio transcoding
How can Huawei online match improve the success rate of player matching
PHP book borrowing management system, with complete functions, supports user foreground management and background management, and supports the latest version of PHP 7 x. Database mysql
Logstack configuration details -- elasticstack (elk) work notes 020
JDBC and MySQL database
Golang Modules
Golang type comparison
Kubernetes CNI 插件之Fabric
2022-2028 global industry research and trend analysis report on anterior segment and fundus OTC detectors
H5 audio tag custom style modification and adding playback control events
Four common methods of copying object attributes (summarize the highest efficiency)