Questions: 5 831

Answers by our Experts: 5 728

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

Write a program that has a class Train with data members-no_of seats_sleeper, no_ of_seats_2Tier, no_of_seats_3Tier and member functions to set and display data. Derive a class Reservation that has data members-seats_Booked_sleeper, , no_ of_seats_Booked_2Tier, no_of_seats_Booked_3Tier, and a functions to book and cancel tickets, and display status

I want you to make a array/list 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, on separate lines.

Care to do that for me?


Input

A line containing integers separated by a space.


1·64·32·2·11

Output

Multiple lines containing an integer.


1
64
32
2
11

We've already made arraying/listing the easy way, but how about arraying/listing and printing the list 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 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/list.

The next lines contains the items of the array/list (integers).

5
1
64
32
2
11

Output

Multiple lines containing integers.


11
2
32
64
1

We've already tried printing out the values of an array in reversed order, right? Today, we shall compute for the squares of all the numbers.


There's already a predefined array/list containing 100 integer values. Loop through each values, compute their squares, and display them.


Output

Multiple lines containing an integer.


4
9
25
10000
49
9
25
9
1
16
.
.
.

We've already made arraying/listing the easy way, but how about arraying/listing and printing the list 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 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/list.

The next lines contains the items of the array/list (integers).

5
1
64
32
2
11

Output

Multiple lines containing integers.


11
2
32
64
1

I want you to make a array/list 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, on separate lines.

Care to do that for me?


Input

A line containing integers separated by a space.


1·64·32·2·11

Output

Multiple lines containing an integer.


1
64
32
2
11

Remember the game of FizzBuzz from the last time? Well, I thought of some changes in the game, and also with the help of loops as well. Firstly, you'll be asking for a random integer and then loop from 1 until that integer. Then, implement these conditions in the game:

  • print "Fizz" if the number is divisible by 3
  • print "Buzz" if the number is divisible by 5
  • print "FizzBuzz" if the number is divisible by both 3 and 5
  • print the number itself if none of the above conditions are met


Input

A line containing an integer.


15

Output

Multiple lines containing a string or an integer.


1
2
Fizz
4
Buzz
Fizz
7
8
Fizz
Buzz
11
Fizz
13
14
FizzBuzz

As I've said before, there are three types of numbers: the positive, the zero, and the negative ones. Today, we shall pay attention only to the negative ones now. Make a loop that will accept random decimal/float numbers. When the user inputs 0, the loop will terminate and then output the sum of all negative numbers inputted in 3 decimal places.


Let's code this.


Input

Multiple lines containing a decimal .


2.4434
-1.3433
-2.444
6.432
0

Output

A line containing a decimal with three decimal places.


-3.787

I'm really fond of even numbers, you know? That's why I'll be letting you make another even number problem yet again. This time, you need to print from a range of two inputted numbers, n1 and n2 (inclusive), all the even numbers from n2 down to n1, in descending order.

How about that?


Input

A line containing two integers separated by a space.


3·10

Output

Multiple lines containing an integer.


10
8
6
4

The greatest common divisor, also known as GCD, is the greatest number that will, without a remainder, fully divide a pair of integers.


Now, I want you to make a program that will accept two integers and with the use of loops, print out their GCD. Make good use of conditional statements as well.

Off you go!


Input

A line containing two integers separated by a space.


6·9

Output

A line containing an integer.


3
LATEST TUTORIALS
APPROVED BY CLIENTS