We've already made listing an array the easy way, but how about listing and printing the array in reverse order?
Make a program that will input an integer and then using loops, add items on an array/list one by one for the same number of times as that of the first inputted integer. Then, print out the array/list in ascending order. After doing that, print the array again on the next line in reverse order, that is, starting from the last item on the array/list down to the first one, each in separated lines.
Input
The first line contains the size of the array.
The next lines contains the items of the array (integers).
5
1
64
32
2
11Output
The first line contains the elements of the array printed in ascending order.
The second line contains the elements of the array printed in reversed order.
1·64·32·2·11
11·2·32·64·1by CodeChum Admin
Make 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.
Presentby CodeChum Admin
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
8I want you to make an array of numbers for me. All you have to do is make a program that will let me input any random integer in one line. Afterwards, it will then print out all the numbers I've inputted, backwards, on separate lines.
Care to do that for me?
Input
The first line contains the size of the array.
The next line contains the integers separated by a space.
5
1·64·32·2·11Output
Multiple lines containing integers on each.
11
2
32
64
1Quotation marks are usually paired with a similar type, like a double quote (") paired with another double quote ("), and the same goes for single quotes ('). However, I'd like to try complicating things by putting together a pair of a double quote(") and a single quote(') in one statement!
Can you do this simple challenge?
Output
A line containing a string.
"'
Write a program that will get two numbers and print the average
Quotation marks are usually paired with a similar type, like a double quote (") paired with another double quote ("), and the same goes for single quotes ('). However, I'd like to try complicating things by putting together a pair of a double quote(") and a single quote(') in one statement!
Can you do this simple challenge?
Output
A line containing a string.
"'
Complete the Cat class so the main function above produces the following output:
White cat is sitting Black cat is sitting
Brown cat is jumping
Red cat is purring Blue cat is sitting Purple cat is jumping
Complete the Cat class so the main function above produces the following output:
White cat is sitting Black cat is sitting
Brown cat is jumping
Red cat is purring Blue cat is sitting Purple cat is jumping
Create 4 variables and assign each one to the following values:
the letters 'M', 'V', and 'P' on the first three variables
the number 10 on the fourth variable
You may name the variable anything you want as long as it follows proper naming convention.
Using the variables you've created, print the cheer message like the one displayed in the output sample below. The first line contains the cheer message for the MVP, and the second line containing a cheer message with the MVP’s jersey number, all in uppercase.