#include<stdio.h>
char *input(char *p) //collecting array with char pointer
{
input: scanf("%s",p);//reading input
if(check(p)) //checking if any alphabets are present in the password
{
printf("enter only digits\n");
goto input;
}
return p;
}
int check(char *p)
{
while(*p)
{
if(*p<48||*p>57)
return 1;
p++;
}
return 0;
}
int main()
{
char password[5],*ptr=NULL;
printf("enter the 4 digit password\n");
ptr=input(password);
printf("entered password is %s\n",ptr);
}