当前位置:网站首页>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;
}
边栏推荐
- [understanding by chance-37]: the structure of human sensory system determines that human beings are self-centered
- jvm-对象生命周期
- Common plug-ins for vite project development
- Redis: commandes d'action pour les données de type chaîne
- js . Find the first palindrome string in the array
- Dynamic programming 01 knapsack and complete knapsack
- Scroll detection of the navigation bar enables the navigation bar to slide and fix with no content
- 小项目(servelt+jsp+mysql+EL+JSTL)完成一个登录功能的Servlet,具有增删改查的操作。实现登录身份验证,防止非法登录,防止多点登录,记住用户名密码功能。
- Redis: operation command of string type data
- Doxorubicin loaded on metal organic framework MIL-88 DOX | folic acid modified uio-66-nh2 doxorubicin loaded [email
猜你喜欢
Global event bus
MySQL 数据处理值增删改
FPGA测试方法以Mentor工具为例
Conversion function and explicit
UiO-66-COOH装载苯达莫司汀|羟基磷灰石( HA) 包裹MIL-53(Fe)纳米粒子|装载黄芩苷锰基金属有机骨架材料
Go language web development series 29: Gin framework uses gin contrib / sessions library to manage sessions (based on cookies)
金属有机骨架MOFs装载非甾体类抗炎药物|ZIF-8包裹普鲁士蓝负载槲皮素(制备方法)
Mysql:insert date:SQL 错误 [1292] [22001]: Data truncation: Incorrect date value:
Configure stylelint
Spring cup eight school league
随机推荐
Too many files with unapproved license
Back to top implementation
[combinatorics] permutation and combination (examples of combinatorial number of multiple sets | three counting models | selection problem | combinatorial problem of multiple sets | nonnegative intege
Invalid Z-index problem
Programmable logic device software testing
js 2023. String pair equal to the target string after connection
Go 1.16.4: manage third-party libraries with Mod
Interface for querying IP home
Qt学习24 布局管理器(三)
全局事件总线
解决MySql 1045 Access denied for user ‘root‘@‘localhost‘ (using password: YES)
Mysql:insert date:sql error [1292] [22001]: data truncation: incorrect date value:
金属有机骨架(MOFs)抗肿瘤药载体|PCN-223装载甲硝唑|UiO-66包载盐酸环丙沙星([email protected])
Redis:Redis的数据结构、key的操作命令
FPGA测试方法以Mentor工具为例
Qt学习21 Qt 中的标准对话框(下)
Why are grass-roots colleges and universities with "soil and poverty" called "Northeast small Tsinghua"?
关于回溯问题中的排列问题的思考(LeetCode46题与47题)
Using registered classes to realize specific type matching function template
Comprehensive case of MySQL data addition, deletion, modification and query