Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <sys/param.h>
- int sec;
- int min;
- int hour;
- int main() {
- seco:
- for(sec = 0; sec < 60; sec++) {
- system("clear");
- if(sec < 10) {
- printf("%d:%d:0%d\n", hour, min, sec); }
- else {
- printf("%d:%d:%d\n", hour, min, sec); }
- sleep(1);
- if (hour > 24) {
- hour = 0; }
- if (min > 60) {
- hour++;
- min = 0; }//fi
- }//rof
- if (sec > 59 ) {
- min++;
- goto seco; }//fi
- }//niam
- [lucer@archie c]$ cat neoclock.c
- #include <stdio.h>
- #include <stdlib.h>
- #include <sys/param.h>
- int sec;
- int min;
- int hour;
- int main() {
- seco:
- for(sec = 0; sec < 60; sec++) {
- system("clear");
- if(sec < 10) {
- printf("%d:%d:0%d\n", hour, min, sec); }
- else {
- printf("%d:%d:%d\n", hour, min, sec); }
- sleep(1);
- if (hour > 24) {
- hour = 0; }
- if (min > 60) {
- hour++;
- min = 0; }//fi
- }//rof
- if (sec > 59 ) {
- min++;
- goto seco; }//fi
- }//niam
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement