Here is my code that take count as input and then takes that number of cities as input.
I want to print all the cities starting from that letter but program ends before taking the character as input.
But it doesn't take character input
#include <stdio.h>
void main()
{
char a[20][10];
char ch;
int i,n;
printf("Enter nos of cities\n");
scanf("%d",&n);
for ( i = 0; i < n ; i++)
{
scanf("%s",a[i]);
}
printf("\n");
printf("Enter 1st character\n");
scanf("%c", &ch);
for ( i = 0; i < n ; i++)
if(ch==a[i][0])
printf("%s\n",a[i]);
}
OUPUT:
Enter nos of cities
3
asd
zxc
qw
Enter 1st character