in this code on enter a number loop runs that many times but I can input data when loop runs for first time **clockformat is just a function that converts 12-hour clock to 24-hour clock
#include<stdio.h>
#include<string.h>
#include<conio.h>
void clockformat(char *a)
void main()
{
int i,t,n;
printf("enter the number of test cases ");
scanf("%d",&t);
char meettime1[8],availtime[17],meettime[8];
for(i=1;i<=t;i++)
{
char meettime[8];
printf("enter meeting time\n");
gets(meettime);
clockformat(&meettime[0]);
printf("time in 24 hour format = %s\n",meettime);
printf("%d\n",i);
}
}
Running program with input:- 3 and 11:23 PM and 04:34 PM
enter the number of test cases 3
enter meeting time
time in 24 hour format =
1
enter meeting time
11:23 PM
time in 24 hour format = 23:23 PM
2
enter meeting time
04:34 PM
time in 24 hour format = 16:34 PM
3
1,2,3 are just to show that loop is running 3 times but I cannot give input for first time.