In this article, we will discuss how to generate a random password of a given length consists of any characters.
- The below-given program involves basic concepts like variables, data types, array, loop, etc.
- Follow the below steps to solve this problem:
- Take the length of the password and declare a character array of that length to store that password.
- Declare character array of all the capital letters, small letters, numbers, special characters.
- Now according to the program below, respective if-else gets executed and a random password gets generated.