the while loop is not working here.there is no compilation error and the print statement is also getting executed in the beggining.the code works fine without the while loop.the code is to print the most repeating letter in a string and the number of times it is repeated
#include <stdio.h>
#include <string.h>
int main(void)
{
int t;
int tempC;
scanf("%d",&t);
while ( (tempC = getchar()) != '\n' && tempC != EOF );
while(t--)
{
char c[100];
char r='z';
int i,j=0,count,a,k,amx;
gets(c);
k=strlen(c);
for(i=0,amx=1;i<k;i++)
{
if(c[i]!=0)
{
for(j=0,count=1;j<k;j++)
{
if(c[i]==c[j])
{
if(i!=j)
{
count++;
c[j]=0;
}
a=count;
if(a>amx||(a==amx&&(c[i]<r)))
{
amx=a;
r=c[i];
}
}
}
}
}
printf("%d %c\n",amx,r);
}
}