Lucky Four problem: LUCKFOUR

Why wrong answer?

#include <stdio.h>
    void main()
    {
    	int t, n, count;
    	scanf("%d", &t);
    	while(t--)
    	{
    		count=0;
    		scanf("\n%d",&n);
    		while(n>0){
    		if(n%10==4)
    		{
    			count++;
    		}
    		n=n/10;
    	}
    	printf("\n%d", count);
    	}
    }

@sanc_02 printf should be inside while loop