In this problem, we are given a string password. Our task is to print * in place of characters of the password.
Let’s take an example to understand the problem,
Input: password Output ********
To solve this problem, we will traverse the password we have entered and print * in place of characters of the password.
Example
The below program will show the implementation of our solution
#include <stdio.h>
#include <string.h>
int main() {
char password[50] = "password";
int length = strlen(password);
printf("Password : ");
for(int i = 0; i<length; i++){
printf("*");
}
return 0;
}Output
Password : ********