My friend attend an interview , in that he was failed to ans a question. The question was like this Program to find the datatype of a given Input. He asked me and I was able to crack up to this,
include<stdio.h>
main()
{
char n;
printf("\nEnter a character: ");
scanf("%c",&n);
if(isdigit(n))
printf("\nInteger");
else
printf("\nCharacter");
}
But it will tell only integer or charector. But the actual question in interview is user will enter only numeric input and program has to tell weather it is int, float or double.How to do this please help me in this.