Write a c program which takes password from user





Write a c program which takes password from users

C source code for password:

#include<stdio.h>
#define MAX 500

int main(){

    char password[MAX];
    char p;
    int i=0;

    printf("Enter the password:");
   
    while((p=getch())!= 13){
         password[i++] = p;
         printf("*");
    }

    password[i] = '\0';

    if(i<6)
         printf("\nWeak password");

    printf("\nYou have entered: %s",password);

    return 0;
}

Sample output:
Enter the password:*******
You have entered: fgt67m,





1. Write a c program to convert decimal number to hexadecimal number.
3. Write a c program to convert octal number to decimal number.
4. Write a c program to convert octal number to hexadecimal number.
5. Write a c program to convert hexadecimal number to decimal number.
6. Write a c program to convert hexadecimal number to octal number.
8. Write a c program to convert binary number to hexadecimal number.
9. Write a c program to convert binary number to octal number.
11. Write a c program to convert hexadecimal number to binary number.
12. Write a c program to convert octal number to binary number.
14. Write a c program to convert centigrade to fahrenheit.

13 comments:

Anonymous said...

Password program is not running.. plz check.. I need this program.

Anonymous said...

The Above Program is Executed Correctly., But it will take Garbage Values as input too...

Unknown said...

program that accepts user name from user and password by using command line arguments.
user name should be declare in array in the program.if we entered wro0ng username it have to give ,username is wrong on output screen?

Unknown said...

program that accepts user name from user and password by using command line arguments.
user name should be declare in array in the program.if we entered wro0ng username it have to give ,username is wrong on output screen?

Unknown said...

just use a getch() command in place of return 0 ....It will work

aman said...

just include header file conio.h, it will work

Unknown said...

what do the (while(xxxxx)!=13)mean?do 13 means something?

Unknown said...

plz explain while((p=getch())!= 13)

Unknown said...

i understood 13 is ascii value of enter key

Unknown said...

It is executed i had checked

Unknown said...

Plz explain while statement.......

Unknown said...

really...

Unknown said...

plse send me a programme for below questions
1. Write a C program to take details of 5 books (title, authors, pages, price) using Structures,
-order them based on the names by passing structure array to a function using pointers.(Ordering the records must be done using pointers.)
-Search for book that has a combination of authors.