Write a program that first reads an integer for the array size,
then reads characters into the array, and displays the consonants (i.e., a character
is displayed only if it a consonant). (Hint: Read a character and store it to an array
if it is not a vowel. If the character is a vowel, discard it. After the input, the array
contains only the consonants.)
Write a program that first reads an integer for the array size, then
reads numbers into the array, counts the even numbers and the odd numbers and
displays them.
Write algorithm using pseudocode and flowchart that uses while loops to perform the
following steps:
i. Prompt the user to input two integers: firstNum and secondNum note that firstNum
must be less than secondNum.
ii. Output all odd numbers between firstNum and secondNum.
iii. Output the sum of all even numbers between firstNum and secondNum.
iv. Output the numbers and their squares between firstNum and secondNum.
v. Output the sum of the square of the odd numbers between firstNum and secondNum.
b. Redo Exercise (a) using for loops.
c. Redo Exercise (a) using do. . .while loo
Write a menu driven program that achieves the following:
Write a program with total change amount as an integer input, and output the change using the fewest coins, one coin type per line. The coin types are Dollars, Quarters, Dimes, Nickels, and Pennies. Use singular and plural coin names as appropriate, like 1 Penny vs. 2 Pennies.
Ex: If the input is:
0 (or less than 0), the output is:
No change Ex: If the input is:
45the output is:
1 Quarter
2 Dimes Write a program whose inputs are three integers, and whose output is the smallest of the three values.
Ex: If the input is:
7 15 3the output is:
3The population of a town A is less than the population of town B. However, the population of
town A is growing faster than the population of town B. Write algorithm using pseudocode and
flowchart that prompts the user to enter the population and growth rate of each town. The
algorithm outputs after how many years the population of town A will be greater than or equal to
the population of town B and the populations of both the towns at that time. (A sample input is:
Population of town A = 5000, growth rate of town A = 4%, population of town B = 8000, and
growth rate of town B =2%)
New Dictionary
Peter is making a new dictionary.He wants to arrange the words in the ascending order of their length and later arrange the ones with the same length in lexicographic order.Each word is given a serial number according to its position.Find the word according to the serial number.
Input
The first line of input is a positive integer which is the serial number.
Word Serial Number
A 1
B 2
C 3
... ...
X 24
Y 25
Z 26
AA 27
AB 28
... ...
BA 53
... ...
ZZ 702
AAA 703
Explanation
Given serial number is 42.
As the serial number is between 26 and 52, the first character of the word is A.The remaining counter of the serial number is 16 (42-26).
The second character of the word is the 16th alphabet, which is P.
So, the output should be AP.
Sample Input1
42
Sample Output1
AP
Sample input2
751
Sample output2
ABW
a. Write algorithm using pseudocode and flowchart that uses while loops to perform the
following steps:
i. Prompt the user to input two integers: firstNum and secondNum note that firstNum
must be less than secondNum.
ii. Output all odd numbers between firstNum and secondNum.
iii. Output the sum of all even numbers between firstNum and secondNum.
iv. Output the numbers and their squares between firstNum and secondNum.
v. Output the sum of the square of the odd numbers between firstNum and secondNum.
b. Redo Exercise (a) using for loops.
c. Redo Exercise (a) using do. . .while loops.
New Dictionary
Peter is making a new dictionary.He wants to arrange the words in the ascending order of their length and later arrange the ones with the same length in lexicographic order.Each word is given a serial number according to its position.Find the word according to the serial number.
Input
The first line of input is a positive integer which is the serial number.
Output
The output should be a single line containing the word that represents the serial number.
Explanation
Given serial number is 42.
As the serial number is between 26 and 52, the first character of the word is A.The remaining counter of the serial number is 16 (42-26).
The second character of the word is the 16th alphabet, which is P.
So, the output should be AP.
Sample Input1
42
Sample Output1
AP
Sample input2
751
Sample output2
ABW