Ok this is what I came up with so far using the knowledge I know. The program should operate like this:
Sample Input
1300
Sample Output
1300 in Ottawa
1000 in Victoria
1100 in Edmonton
1200 in Winnipeg
1300 in Toronto
1400 in Halifax
1430 in St. John’s
However my code seems to not display some numbers at the end of the output. Can anyone help please?
insert
Code:
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
int hrs,min;
int vic,edm,win,hal,stj;
scanf("%2d%2d", &hrs, &min);
if ( hrs <= 23 && min <= 59 ) {
vic = hrs - 3;
edm = hrs - 2;
win = hrs - 1;
hal = hrs + 1;
stj = hrs + 1, min + 30;
printf("The time in Ottawa is %d%d\n", hrs, min);
printf("The time in Victoria is %d%d\n", vic, min);
printf("The time in Edmonton is %d%d\n", edm, min);
printf("The time in Winnipeg is %d%d\n", win, min);
printf("The time in Toronto is %d%d\n", hrs, min);
printf("The time in Halifax is %d%d\n", hal, min);
printf("The time in St.John's is %d%d\n", stj);
}
system("PAUSE");
return 0;
}
The program is not complete yet, but I need to match the sample output before moving on