tinh tong thoi gian
/*tinh tong thoi*/
#include<stdio.h>
#include<conio.h>
int main()
{
int h1,p1,s1,h2,p2,s2,h,p,s;
int tong;
printf("nhap vao chi so thoi gian thu nhat:");
scanf("%d%d%d",&h1,&p1,&s1);
printf("nhap vao chi so thoi gian thu hai:");
scanf("%d%d%d",&h2,&p2,&s2);
tong=(h1+h2)*3600+(p1+p2)*60+s1+s2;/*tinh tong so giay*/
h=tong/3600;/*tinh so gio tong cong*/
tong=tong-h*3600;/*so giay con lai*/
p=tong/60;/*=> so phut*/
tong=tong-p*60;/*con lai la so giay*/
s=tong;
printf("tong chi so hai thoi gian la:%dh %dp %ds",h,p,s);
getch();
return 0;
}
Bạn đang đọc truyện trên: AzTruyen.Top