C program to print password as star ( ***** )
#include<stdio.h>
int main(){
int i;
char
ch1, password[10];
printf("Enter
your password:");
for(i=0;
i<10; i++)
{
ch1=getch();
password[i]=ch1;
if(ch1!=13) //13 is ASCII of Enter key
printf("*");
break;
}
password[i]='\0';
printf("\n%s",
password);
return 0;
}
|
Output of the program:
Enter your password:*****
Your actual password is hello
No comments:
Post a Comment