Q.Write a function to accept 20 characters and display whether each character input is a digit, lower case letter or upper case letter.
Solution I tried
#include<stdio.h>
#include<conio.h>
int main()
{
char inp;
int i;
clrscr();
for(i=0;i<20;i++)
{
printf("Enter a character\n");
scanf("%c",&inp);
if(inp>='0'&& inp<='9')
{
printf("It is a digit\n");
}
else if(inp>='A'&& inp<='Z')
{
printf("It is upper case letter\n");
}
else if(inp>='a'&& inp<='z')
{
printf("It is lower case letter\n");
}
}
return 0;
}
But the problem is that when i run it, the comment "enter a character " appears twice. So instead of 20 characters, it takes only 10. Please help!!!