Advertisement
nguyenhappy92

Xuất ra giờ, phút, giây tiếp theo

Nov 24th, 2015
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. // Khai bao ham thu vien neu co
  2. #include<stdio.h>
  3. #include<conio.h>
  4. // chuong trinh chinh
  5. void main()
  6. {
  7. int h,m,s;
  8. scanf("%d%d%d",&h,&m,&s);
  9. if((h>=0 && h<24) && (m>=0 && m<60) &&(s>=0 && s<60))
  10. {
  11. if(s<59)
  12. s++;
  13. else
  14. {
  15. if(m<59)
  16. {
  17. m++;s=0;
  18. }
  19. else
  20. {
  21. if(h<23)
  22. {
  23. h++;
  24. m=0;
  25. s=0;
  26. }
  27. else
  28. {
  29. h=0;m=0;s=0;
  30. }
  31.  
  32. }
  33. }
  34. printf("%d %d %d",h,m,s);
  35. }
  36. else
  37. {
  38. printf("0");
  39. }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement