当前位置:网站首页>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:10Code
#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;
}
边栏推荐
- 从零开始的基于百度大脑EasyData的多人协同数据标注
- FPGA测试方法以Mentor工具为例
- Qt学习24 布局管理器(三)
- Raft 协议
- Rasp implementation of PHP
- Uniapp skills - dom display and hiding
- [combinatorics] permutation and combination (examples of combinatorial number of multiple sets | three counting models | selection problem | combinatorial problem of multiple sets | nonnegative intege
- TS code automatically generates JS
- Folic acid modified metal organic framework (zif-8) baicalin loaded metal organic framework composite magnetic material (AU- [email
- 交联环糊精金属有机骨架负载甲氨蝶呤缓释微粒|金属-有机多孔材料UiO-66负载黄酮苷类药物|齐岳
猜你喜欢

Programmable logic device software testing

JS Part III

JS input number and standard digit number are compared. The problem of adding 0 to 0

QT learning 24 layout manager (III)

MySQL 数据处理值增删改

GoLand 2021.1: rename the go project

Uniapp tips - scrolling components

Common network state detection and analysis tools

Redis: commandes d'action pour les données de type chaîne

QT learning 17 dialog box and its types
随机推荐
JS shift operators (< <,> > and > > >)
Interface for querying IP home
Dynamic programming 01 knapsack and complete knapsack
Vite project commissioning
Another industry has been broken by Chinese chips. No wonder the leading analog chip companies in the United States have cut prices and sold off
js . Find the first palindrome string in the array
关于回溯问题中的排列问题的思考(LeetCode46题与47题)
Spring cup eight school league
Generate directories from web content
[acnoi2022] guess numbers
Toast UI editor (editor allows you to edit your markup document using text or WYSIWYG, with syntax highlighting, scrolling synchronization, real-time preview and chart functions.)
JVM垃圾回收机
Print. JS -- web page file printing
Solve MySQL 1045 access denied for user 'root' @ 'localhost' (using password: yes)
JS download files through URL links
QT learning 22 layout manager (I)
MySQL 数据增删改查综合案例
Metal organic framework MOFs loaded with non steroidal anti-inflammatory drugs | zif-8 wrapped Prussian blue loaded quercetin (preparation method)
Current situation, analysis and prediction of information and innovation industry
Metal organic framework (MOFs) antitumor drug carrier | pcn-223 loaded with metronidazole | uio-66 loaded with ciprofloxacin hydrochloride(