Questions: 1 680

Answers by our Experts: 1 680

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

Using linked list , take two input polynomials from user and create a new polynomial such that it first multiplies the first polynomial by x^(degree of second polynomial) and then adds it to the second polynomial .


Write a program in c language that could prompt the user to select a mathematical figure either circle or rectangle . The program then compute the perimeter of the figure.

Cubes and Squares

by CodeChum Admin

You can also make a list of numbers, ey? Let's go and have some fun in tweaking the values of each element, but let's give it some twist to add on some fun to the code.


Let's have a go at it!


Instructions:

  1. An array containing 40 integer elements is already provided for you in the code editor below.
  2. Using loops and conditions, print out the cube of the array element if it is a positive number, and print out the square of the number if it is negative. Each result must be printed out separately by each line.

Output

The squares and cubes of the elements in the array.

4
1
1
8
27
.
.
.

Miss Ural wants to buy colors for Holi, and that too, at the cheapest cost!

There are N shops selling colors near Ural's house, where the i′th shop sells colors at rate of Ri for one unit. Also, i′th shop is located at a distance of Di kilometers from her house. Life was simple, but then petrol and fuel prices soared up. The current price of petrol to travel one kilometer is K

Find the minimum cost at which Miss Ural can buy one unit of color. she does not need to return back home.


  • The first line of input contains T, number of test cases in a file.
  • The next line contains two integers, N and K, as described in the problem statement.
  • The next line contains N space separated integers, denoting Di, i.e. distance of the shop.
  • The next line contains N space separated integers denoting Ri, i.e. rate of the color.


For test case, output minimum cost to purchase 1 unit of color.


  • 1≤T≤10^5
  • 1≤N≤10^5
  • Sum of N over all T in a test file does not exceed 10^6.
  • 1≤Ri,K,Di≤10^9

You are given an array of N non-negative integers: A1, A2, ..., AN. An alternating subsequence is a subsequence in which the indices of any two consecutive elements differ by exactly two in the original array. That is, if Ai1, Ai2, ..., Aik is some subsequence, then for it to be an alternating subsequence, (i2 - i1 = 2), (i3 - i2 = 2), and so on should all hold true. Among all alternating subsequences, find the one which has maximum sum of elements, and output that sum.


Input

The first line of the input contains an integer T denoting the number of test cases.


The first line of each test case contains an integer N denoting the number of elements in the array.


The second line contains N space-separated integers A1, A2, ..., AN denoting the array A.


Output

For each test case, output a single line containing the answer.


Note

A subsequence with only a single integer is also an alternating subsequence.

Constraints

1 ≤ T ≤ 10

1 ≤ N ≤ 105

0 ≤ Ai ≤ 105


Negative Allergy

by CodeChum Admin

Whole numbers are great, but I think we should also pay attention to decimal numbers, too.


So, how about we make a program that involves a lot of decimals?


Instructions:

  1. Continuously ask for floating point values (decimal numbers) using the do…while() loop, sum them all up, and store the total into one variable.
  2. The loop shall only terminate for the following reasons:
  3. A negative decimal number is inputted (but still included in the total sum)
  4. The total sum reaches 100.0 or more

Input


1. A series of float numbers

Output


The first multiple lines containing message prompts for float numbers.

The last line contains the sum with 2 decimal places.


Enter a number: 1.1
Enter a number: 1.2
Enter a number: 1.3
Enter a number: 1.4
Enter a number: -1.0
Sum = 4.00

Against All "Odds"

by CodeChum Admin

Looping numbers is fun, but it's even more exciting when we combine complex tasks to it, just like looping through a series of numbers and performing a series of code only to special numbers, like odd ones! And today, we're going to do just that.


Are you ready?


Instructions:

  1. Input a positive integer. This will serve as the starting point of the loop.
  2. Using a while() loop, print out all the odd numbers starting from the inputted integer, until 0. The outputted numbers must all be separated by line.
  3. Also remember that since the loop goes to descending order, a decrement variable shall be created and decreased per iteration for the loop to terminate when it reaches 0.

Input


1. An integer

Output


The first line will contain a message prompt to input the integer.

The succeeding lines contain the odd numbers.

Enter n: 10
9
7
5
3
1

 Visibly Divisible

by CodeChum Admin

Do you still know what being divisible by a certain number means? In case you forgot, being divisible means that the number is capable of being divided by another number without a remainder. With this knowledge, you can surely solve this problem!


Instructions:

  1. Input one integer.
  2. Make a conditional statement that contains the following conditions:
  3. If the integer is only divisible by 3, print "Divisible by 3"
  4. If the integer is only divisible by 4, print "Divisible by 4"
  5. If the integer is divisible by both 3 and 4, print "Divisible by 3 and 4"

Input


1. An integer

Output


The first line will contain a message prompt to input the integer.

The second line contains the appropriate message.

Enter n: 6
Divisible by 3


Enter n: 12
Divisible by 3 and 4


Enter n: 4
Divisible by 4




Instructions:

  1. Input one number (integer or decimal), an operator (+, -, *, /), and another number (integer or decimal). Again, since we're scanning a character, don't forget to add a space before the character's placeholder like this, " %c", so that it won't be the newline character that will be scanned for the operator.
  2. Print the result of the operation between the two numbers, up to 2 decimal places.

Input


1. First number

2. Operator

3. Second number

Output


The first line will contain a message prompt to input the first number.

The second line will contain a message prompt to input the operator.

The third line will contain a message prompt to input the second number.

The last line contains the result with 2 decimal places.


Enter the first number: 5
Select the operator (+, -, *, /): +
Enter the second number: 0.70
Result = 5.70






The placement season has begun in a college. There are N number of students standing outside an interview room in a line. It is given that a person who goes in first has higher chances of getting selected

LATEST TUTORIALS
APPROVED BY CLIENTS