I have an array of 3 numbers here with me that's already in the code editor, but I want you to add some more to this list by inputting some more numbers yourself in one line and then, print out only the even numbers from the array.
Can you do that for me?
Input
The first line contains the number of elements, n, to be added.
The next line contains the n integers separated by a space.
5
33·54·32·11·8Output
Multiple lines containing an integer.
2
54
32
8Make me a program that accepts two random strings. Then, count the number of vowels that are in each of the strings and put it on separate variables.
Finally, for the survival of the vowels, subtract the total count of vowels of the first string to the vowels of the second string then print out its difference.
Easy, right? Then go and code as if your life depends on it!
Input
Two lines containing a string on each.
C++·is·fuN
CodeChum·is·AWEsomeOutput
A line containing an integer.
6Make a program that will accept an integer and loop for the same number of times as that of the inputted integer and input random integers and add it to the array/list one by one, per line. Afterwards, make your program accept another random integer.
Using that final integer, compare from your array/list if the final integer's value is also present in your current array/list. If so, print "Present"; otherwise, print "None".
Start coding now!
Input
The first line contains the size of the array.
The next lines contain the integers.
The last line contains an integer to be searched.
5
3
21
2
5
23
2Output
A line containing a string.
PresentDefine a class License that has a driving license number, name and address. Define
constructors that take on parameter that is just the number and another where all
parameters are present.
�
Define a class License that has a driving license number, name and address. Define constructors that take on parameter that is just the number and another where all parameters are present.
Write a C++ program which contains a function of bool type and takes an argument of integer type value. The argument is taken from user in main function and calls the bool function. The bool type function will check whether the argument number is a prime number or not. The result will be send back to main function and displays the status of the number
Suppose you are playing a killing game and have to kill few of your enemies. You are at a
cliff and from there you can see few of them. You see the enemies at your height only.
Therefore, you can only kill at the same height. The enemies are forming a balanced binary
tree where their General is at the top of the other cliff, his two commanders are on the first
level below him. The soldiers are at the lowest level. Total four soldiers are appointed. Under
both the commanders exact two soldiers serve.
You have to make a strategy to kill the left commander first, than whoever takes his position
kill him. Now start killing the right side with same strategy until only one enemy is left at left
side. Now increase your height and kill the General. You can only win if only three of your
enemies are left.
Display the enemies who are left and who have been killed. Don’t forget to print your victory
message.
Instructions:
Input one integer.
Print out the integer in one line.
Check whether the integer is odd or not. If it is odd, print "Odd".
Input
A line containing an integer
5
Output
The first line contains the inputted integer.
The second line contains a string which is the result.
5
Odd
Q1. Define a class Deposit that has a principal, a rate of interest, which is fixed for all
deposits and a period in terms of years. Write member functions to
(i) alter(float) which can change the rate of interest.
(ii) interest() which computes the interest and returns it.
(iii) print() which prints data as shown below. Note that the width of each column is 20.
5mks
Q2. Assume that the cell users are two kinds – those with a postpaid option and those
with a prepaid option. Postpaid gives a fixed free talk time and the rest is computed at
the rate of N2.90 per pulse. Prepaid cards have a fixed talk time.
Define a class Cell_user as a base class and derive the hierarchy of classes. Define
member functions and override them wherever necessary to
(i) retrieve the talk time left for each user.
(ii) print the bill in a proper format containing all the information for the postpaid user.
5mks
Input three integers in different lines (one each line).
Print out the integers in one line.
If the 1st integer is greater than or equal to both the 2nd integer and the 3rd integer, print "Yes".
Input
Three lines containing an integer on each.
3
2
1
Output
The first line contains all the three inputted integers.
The second line contains a string which is the result.
3·2·1
Yes