Contact Learn C
Copy Program Share Program

Program 317:Password Generator in C

Program 317:Password Generator using C
 
#include <stdlib.h>
#include <stdio.h>
#include<time.h>
int main() 
{
  int i,password,len;
  srand((unsigned int)time(NULL));
  printf("Enter Password Length and must be greater than 5\n");
  scanf("%d",&len);
  if(len>=5)
  {
     for(i=0;i<len;i++)
      {
      int k=rand()%128;
       if((k>=48&&k<=57)||(k>=65&&k<=90)||(k>=97&&k<=122)||(k>=35&&k<=37)||k==64)
       {
        printf("%c",k);
        }
        else
        {
         i--;
        }
      }
      printf("\n");
  }
  else
  {
   printf("Length should be greater than 5\n");
  }
  return(0);
}
Explanation:

//Coming Soon...

Output:
Password Generator in C

Password Generator in C



Download App and Learn when ever you want

Get it on PlayStore
Get it on Amazon App Store
Get it on Aptoide