Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <math.h>
- #include <time.h>
- int main()
- {
- // Hours, minutes and seconds
- int hh;
- int mm;
- int ss;
- // Rise and shine, Mr. Clock
- hh = 0;
- mm = 0;
- ss = 0;
- // A clock always works
- while (1) {
- while(hh < 24) {
- while(mm < 60) {
- while(ss < 60) {
- sleep(1);
- ss++;
- // What time is it?
- printf("%d : %d : %d \t\t Close with Ctrl+C \r", hh, mm, ss);
- }
- mm++;
- ss = 0;
- }
- hh++;
- mm = 0;
- }
- hh = 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement