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

Maximum

You are given

N number of inputs. Print the maximum of them after each input.Input

The first line of input is an integer

N. The next N lines each contain an integer as input.Explanation

In the example, you are given

6 inputs 1, 0, 3, 2, 9, 8.

1 is maximum in the input 1.

1 is maximum in the input 1, 0.

3 is maximum in the input 1, 0, 3.

3 is maximum in the input 1, 0, 3, 2.

9 is maximum in the input 1, 0, 3, 2, 9.

9 is maximum in the input 1, 0, 3, 2, 9, 8.

 


So, the output should be


1

3

3

9

9




Given the following values,
10, 50, 30, 40, 20.
Define an array that will store the values
and use the bubble sort to display them in
descending order and in ascending order.

Results 'can' look like this:

Before Desc Asce
10 50 10
50 40 20
30 30 30
40 20 40
20 10 50

1. Write a C program to add two matrix using functions & dynamic memory allocation. Also check for addition compatibility.



2. Write a C program to multiply two matrix using functions & dynamic memory

allocation. Also check for multiplication compatibility.

1. Write a C program to find the frequency of even numbers in matrix using functions & dynamic memory allocation.

 

2. Write a C program to find the trace of (sum of diagonal element) matrix using

functions & dynamic memory allocation.


1. Write a C program to arrange row elements in ascending order using functions & dynamic memory allocation.

 

2. Write a C program to arrange column elements in ascending order using functions &

dynamic memory allocation.


1. Write a C Program to find sum and subtraction of two matrices using functions & dynamic memory allocation.


2. Write a C program to check two matrices are identical or not using functions & dynamic memory allocation.


Last half of List

You are given an integer 

N as input. Write a program to read N inputs and print a list containing the elements in the last half of the list.

Input

The first line of input is an integer 

N. The second line contains N space-separated integers.

Explanation
Sample Output 1

In the example, we are given 

6 numbers 1, 2, 3, 4, 5, 6 as input.

The last half of elements of the list are 

4, 5, 6. So, the output should be [4, 5, 6].

Sample Output 2

In the example, we are given 

5 numbers 1, 11, 13, 21, 19 as input. The last half of elements of the list are 21, 19. So, the output should be [21, 19].

Sample Input 1
6
1 2 3 4 5 6
Sample Output 1
[4, 5, 6]
Sample Input 2
5
1 11 13 21 19
Sample Output 2
[21, 19]

List Indexing - 3

Given 

N numbers, and an index, write a program to store the numbers in a list and print the number at given index. For this problem, each input will contain T testcases. Each testcase will give an index Ki as input, which should be considered to print the number.

Input

The first line of input is an integer 

N. The second line of input is an integer T representing the number of testcases. The next N lines contain integers representing the numbers of the list. The next T lines contain integer Ki for each line.

Output

You need to print a number in a new line for each of the 

K testcases.

Explanation

In the given example, we are given 

4 numbers 1, 2, 3, 4 as input For the first testcase, K=0, the number at 0th index is 1. For the second testcase, K=3, the number at 3rd index is 4. So, the output should be

1
4
Sample Input 1
4
2
1
2
3
4
0
3
Sample Output 1
1
4
Sample Input 2
3
1
13
21
19
0
Sample Output 2
13

Shaded Diamond

Given an integer value 

N as input, write a program to print a shaded diamond of 2*N -1 rows using an asterisk(*) character as shown below.

Note: There is a space after each asterisk (*) character.

Input

The first line of input is an integer 

N.

Explanation

In the given example 

N = 5. Therefore, the output should be

    * 
   * * 
  * * * 
 * * * * 
* * * * * 
 *     *
  *   *
   * *
    *
Sample Input 1
6
Sample Output 1
     * 
    * * 
   * * * 
  * * * * 
 * * * * * 
* * * * * * 
 *       *
  *     *
   *   *
    * *
     *
Sample Input 2
5
Sample Output 2
    * 
   * * 
  * * * 
 * * * * 
* * * * * 
 *     *
  *   *
   * *
    *

Number Diamond

Given an integer 

N as input, write a program to print a number diamond of 2*N -1 rows as shown below.

Note: There is a space after each number.

Input

The first line of input is an integer 

N.

Explanation

In the given example, the number of rows in the diamond is 

5.

So, the output should be

    1 
   1 2 
  1 2 3 
 1 2 3 4 
1 2 3 4 5 
 1 2 3 4 
  1 2 3 
   1 2 
    1
Sample Input 1
5
Sample Output 1
    1 
   1 2 
  1 2 3 
 1 2 3 4 
1 2 3 4 5 
 1 2 3 4 
  1 2 3 
   1 2 
    1
Sample Input 2
4
Sample Output 2
   1 
  1 2 
 1 2 3 
1 2 3 4 
 1 2 3 
  1 2 
   1

LATEST TUTORIALS
APPROVED BY CLIENTS