Professional Documents
Culture Documents
Ex 2
Ex 2
Ex 2
1. Compute the time required to double an initial investment amount with a specified
rate of interest.
2. Use for loop construct for the following: accept ‘n’ strings as input. Do the following
in each string.
a) reverse the case of each character
b) remove the vowels and print the new string
c) remove the duplicate characters in each string and print the new string
d) compare the current string with the previous string; if they match, print
‘Duplicate value’
4. Define the following conditions for validating a string as a valid password. The
string should have a minimum of 8 characters and maximum 20 characters. It can
contain alphabets(upper and lower case), digits(0 to 9) and the following special
characters only (*, $, #). The password should contain a minimum of one uppercase
letter, one lowercase letter, two digits and only one of the special characters. The
two digits should not be in successive positions. Accept strings as input and print if
they are valid passwords or not.