+ 1
A question named "military time" has insufficient input. It is unable to pass the input correctly(in C).
The problem has inputs hour and minutes with the meridian. But while taking input through scanf function i am unable to get the meridian status. If anyone has solved this problem then please help.
3 Answers
+ 16
//You can use scanf like this too
scanf("%d:%d%s", &hours, &minutes, &meridian);
//use ':' between %d
//note: int from input 00 -> 0. So need more format when printing that "%02d"
//or use string for minutes because we don't need to change it anyway
scanf("%d%s%s", &hours, &minutes, &meridian);
+ 12
Are you talking about "military time" code coach?
https://www.sololearn.com/coach/70?ref=app
I suggest you to learn C tutorial in SoloLearn for sure
//check the formatted input course
https://www.sololearn.com/learn/C/2914/
+ 2
yes you got it.
but I know c language very well.
Check the input code:
//its a snippet
int hour, minutes; char meridian[10];
scanf("%d%d%s",&hour, &minutes, meridian);
//snippet end
i am not getting any input in meridian. please explain.
The input to the problem is of the form:
HH:MM AM/PM
(it is time input in 12 hour clock)