Wednesday, 13 April 2016

Password Validation Check C Language Program

#include<stdio.h>
#include<conio.h>
/******************************************
Develop By Girfa
Visit : http://girfahelp.blogspot.in/2012/09/some-program-of-c-language.html
*******************************************/
void main()
{
char pass[20],ch;
int i,number,special,capital,small;
number=special=capital=small=0;
clrscr();

printf("Enter Password>> ");
gets(pass);
for(i=0;pass[i]!='\0';i++)
{
if(pass[i]>='0' && pass[i]<='9')
number=1;
if(pass[i]>='a' && pass[i]<='z')
small=1;
if(pass[i]>='A' && pass[i]<='Z')
capital=1;
if(pass[i]=='!' || pass[i]=='@' || pass[i]=='#' || pass[i]=='$' || pass[i]=='%' || pass[i]=='*')
special=1;

}
if(number==0 || special==0 || capital==0 || small==0)
printf("\n\tInvalid Password");
else
printf("\n\tValid Password");
getch();
}

Next Question

3 comments:

  1. How do you do this in While Loop not for loop

    ReplyDelete
  2. Can you please tell me how to do this program in while loop

    ReplyDelete