Questions: 1 978

Answers by our Experts: 1 850

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

Mr Kishan owns a supermarket and he has stored the price of all items in an array. However he wants to now increase the price of all items by Rs 5. Write a program using functions which increments the price of all items by Rs 5 and displays the updated list.


total sales a company has four sales people who sell 5 different products. once a day, each salesperson passes in a slip for each different type of product sold. each slip contains a) salesperson id b) product number c) total price (in rs.) of that product sold that day assume that all slip data are stored in a file. write a program that can be used by every salesperson to store his/her data in the file. write another program to generate weekly summary report on every saturday night in a tabular format. report will display (based on user’s choice) a) product-wise daily sale b) salesperson-wise daily sale c) maximum and minimum sale (product and salesperson-wise) d) total summary of weekly sales

Ms. Ashwini has a deck of cards and she wants to find the Fibonacci series of chosen cards. Write an application using functions to find the Fibonacci series of chosen cards. (The Fibonacci numbers are generated by setting F0 = 0, F1 = 1, and then using the recursive formula. Fn = Fn-1 + Fn-2. to get the rest. Thus the sequence begins: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55.).

The requirements to solve the problem are

a: Get the number up to which Fibonacci series is to be calculated.

b: Write a function to calculate the Fibonacci series

c: Print the result


Harry likes candies and he cannot get satisfied with only the ones he buys from the stores. He knows one of the best places to get it a Candy warehoue Vie decades to raid the warehouse located in Mary-ville. The warehouse has m containers, in the ith container there are x i candy boxes each having yi candies. All candy bees are of the same size. Harry is carrying a rucksack which can hold n boxes. He needs to find out which boxes to pick up so that he gets the maximum number of candles in this raid







Can you help him pick up the boxes and report on how many maximum number of candies he could steal?







Input







First line contains integer n (1 <= n <= 2x10^8 ") and integer *m (1 <= m <= 20). The i+ 1th line contains a pair of numbers and yi[1<x< 10^81<=y_j<=10







Output







Single number for the number of candies.







Sample input







73







5 10







25







36

Enter number to check Fibonacci are not

2. 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
.
.
.

You are given an array of N non-negative integers: A1A2., 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 Ai1Ai2., 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

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. Second line contains N space-separated integers A1A2, ..., AN denoting the array A

Constraints

  • 1 ≤ T ≤ 10
  • 1 ≤ N ≤ 105
  • 0 ≤ Ai ≤ 105
Input:
1
3
1 2 5
Output:
6

For the given array [1, 2, 5], there are 7 non-empty subsequences out of which there are 4 alternating subsequences. These will be {[1], [2], [5], [1, 5]}. The alternating subsequence [1, 5] will have the largest sum i.e 6.








Input three random characters and make sure they are inputted on different lines.

Print out the three characters in order, each on a different line, using only 1 printf() statement and newline characters (\n).

An initial code with the one printf() is provided for you, just complete the missing items inside it. Do not add any other printf()'s


Write a C code to merge the contents of the file abc.txt and xyz.txt and save it another file called merge.txt.

write a program which produces the given sequence numbers.(in alternate arrangement) using the three looping statements



LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS