当前位置:网站首页>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;
}
边栏推荐
- “又土又穷”的草根高校,凭什么被称为“东北小清华”?
- Redis: operation command of string type data
- Use vscode to view hex or UTF-8 codes
- Qt学习22 布局管理器(一)
- RocksDB LRUCache
- Dynamic programming 01 knapsack and complete knapsack
- C language standard IO function sorting
- Global event bus
- QT learning 23 layout manager (II)
- Back to top implementation
猜你喜欢

Qt学习18 登录对话框实例分析

GoLand 2021.1: rename the go project

Golang - command line tool Cobra

Qt学习22 布局管理器(一)

Programmable logic device software testing

Qt学习25 布局管理器(四)

Redis:字符串类型数据的操作命令

The small project (servlet+jsp+mysql+el+jstl) completes a servlet with login function, with the operation of adding, deleting, modifying and querying. Realize login authentication, prevent illegal log
[email protected](Fe)|甘草次酸修饰金属有机框架材料UiO-66-NH2(简称UiO-66-NH2-GA)"/>MIL-100( Fe) 包裹小分子阿司匹林形成[email protected](Fe)|甘草次酸修饰金属有机框架材料UiO-66-NH2(简称UiO-66-NH2-GA)

How to use lxml to judge whether the website announcement is updated
随机推荐
Redis: commandes d'action pour les données de type chaîne
The small project (servlet+jsp+mysql+el+jstl) completes a servlet with login function, with the operation of adding, deleting, modifying and querying. Realize login authentication, prevent illegal log
从零开始的基于百度大脑EasyData的多人协同数据标注
Conversion function and explicit
Common network state detection and analysis tools
“又土又穷”的草根高校,凭什么被称为“东北小清华”?
[combinatorics] permutation and combination (examples of combinatorial number of multiple sets | three counting models | selection problem | combinatorial problem of multiple sets | nonnegative intege
MySQL 数据处理值增删改
Redis:字符串类型数据的操作命令
Spring cup eight school league
How to promote the progress of project collaboration | community essay solicitation
Analysis of the characteristics of page owner
Use vscode to view hex or UTF-8 codes
jvm-对象生命周期
28:第三章:开发通行证服务:11:在配置文件中定义属性,然后在代码中去获取;
page owner特性浅析
Common plug-ins for vite project development
怎样删除对象的某个属性或⽅法
jvm-类加载
JVM系列——概述,程序计数器day1-1