Questions: 11 448

Answers by our Experts: 10 707

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

A program is usually not limited to a linear sequence of instructions. During its process it may bifurcate, repeat code or take decisions. For that purpose, C++ provides control structures that serve to specify what has to be done by our program, when and under which circumstances.


(a) What are the differences between a while loop and a do-while loop?


(4 marks)



(b) Convert the while loop in Program 4 to: i. do-while loop.


ii. for loop.


(3 marks) (3 marks)


(c) Develop a program that asks the user to enter an integer. If the user enters integer 1, then the program will display "Got 1" on the screen. If the user enters integer 66, then the program will display "Got 66" on the screen. . If the user enters integer 99, then the program will display "Got 99" on the screen. If the user enters an integer other than these three numbers, the program will display "Got something else" on the screen. You are required to switch structure.

A machine is purchased which will produce earning of Rs.

1000 per year while it lasts. The machine costs Rs. 6000 and

will have a salvage of Rs. 2000 when it is condemned. If 12

percent per year can be earned on alternate investments

what would be the minimum life of the machine to make it a

more attractive investment compared to alternative

investment?


let a and b are two linked list.write a c++ function to create a new linked list c that contains alternately from a and b beginning with first element of A.if you run out of element in one element of the list,then append the remaining elements of the other elements of c.

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




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





Make a program that will accept an integer and loop from 1 to that integer. Then, print all numbers from that range that are greater than 3.


Let's go!


Input

A line containing an integer.

8

Output

Multiple lines containing an integer.

4
5
6
7
8




How many zeroes are there after the last non-zero digit of a million? a trillion? To easily identify that, let us make a program to count and print the number of zeroes after the last non-zero digit of a number. For example, in 20400, there are 2 zeroes after the last non-zero digit of the number, 4.


Are you up for this challenge?


Input

A line containing an integer.

20400

Output

A line containing an integer.

2




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

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


6. Write a C++ program that take two string as input from user and check if both strings are same or not. If same, print YES, otherwise print NO.

LATEST TUTORIALS
APPROVED BY CLIENTS