diff --git a/C/README.md b/C/README.md index 9251eeaa..22050aa9 100644 --- a/C/README.md +++ b/C/README.md @@ -48,6 +48,7 @@ | Program-44 | Program for implementation of the approach | | Program-45 | Program to illustrate the above given pattern of numbers. | | Program-46 | Program to convert binary number to decimal | +| Program-47 | Program to generate strong password | diff --git a/C/program-47/program 47.c b/C/program-47/program 47.c new file mode 100644 index 00000000..0a87a07c --- /dev/null +++ b/C/program-47/program 47.c @@ -0,0 +1,33 @@ +#include +#include +#include + +int main() +{ + /* Length of the password */ + int length; + int num; + int temp; + printf("Enter the length of the password: "); + scanf("%d", &length); + printf("\nEnter the number of passwords you want: "); + scanf("%d", &num); + /* Seed number for rand() */ + srand((unsigned int) time(0) + getpid()); + + while(num--) + { + temp = length; + printf("\n"); + while(temp--) { + putchar(rand() % 56 + 65); + srand(rand()); + } + + temp = length; + } + + printf("\n"); + + return EXIT_SUCCESS; +} diff --git a/Python/program-4/Program 4.py b/Python/program-4/Program 4.py new file mode 100644 index 00000000..77c405f9 --- /dev/null +++ b/Python/program-4/Program 4.py @@ -0,0 +1,9 @@ +# Store input numbers +num1 = input('Enter first number: ') +num2 = input('Enter second number: ') + +# Add two numbers +sum = float(num1) + float(num2) + +# Display the sum +print('The sum of {0} and {1} is {2}'.format(num1, num2, sum))