(I’ve only been coding in C for about 3 weeks so please feel free to tell me if I got anything horrifically wrong.)
In my college programming class, I’m coding this digital clock in C. I can’t figure out why the correct time isn’t showing up. The hour will change but the minutes and seconds will stay at 60 for some reason.
Here’s the code.
#include <stdio.h> #include <stdlib.h> int main () { int h=0,m=0,s=0; printf("enter time in format of hh mm ss"); scanf("%d%d%d", &h,&m,&s); start:; for(h;h<12;h++){ for(m;m<60;m++){ for(s;s<60;s++){ printf("%d:%d:%d",h,m,s); for(double i=0;i<99999999; i++){ i++; i--; } } s=0; } m=0; } goto start; }