my lecturer just said that the output must be the same as posted...
Precisely. If you do not print anything extra, the output will be the same as required.
i'm finding trouble how to obtain the value for hour since i can't printf and ask the user to input it there..
Do not printf() anything other than the required output. Just start reading immediately. The user is assumed to know what to input.
This is an example:
Code:
#include <stdio.h>
int main(void)
{
int x;
scanf("%d", &x);
printf("You entered %d\n", x);
return 0;
}
Sure, it looks strange, but perhaps your lecturer will do I/O re-direction (if you do not know what that is, just ignore it for now).