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

First Prime Number

You are given N inputs. Write a program to print the first prime number in the given inputs.

Input

The first line of input is an integer N. The next N lines each contain an integer. Explanation

In the given example of

5 integers

1

10

4

3

2


The output should be

3.

Sample Input 1

5

1

10

4

3

2

Sample Output 1

3

Sample Input 2

4

2

3

5

7

Sample Output 2

2




W pattern with *

Write a program to print W pattern of N lines using an asterisk(*) character as shown below.

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

Input

The first line is an integer N.

Explanation

For

N = 5The output should be


* * * * * * * * *

* * * * * * * *

* * * * * *

* * * *

* *


Sample Input 1

5

Sample Output 1

* * * * * * * * *

* * * * * * * *

* * * * * *

* * * *

* *

Sample Input 2

4

Sample Output 2

* * * * * * *

* * * * * *

* * * *

* *




Armstrong numbers between two intervals

Write a program to print all the Armstrong numbers in the given range A to B(including A and B). An N-digit number is an Armstrong number if the number equals the sum of the Nth power of its digits.

Input

The first line has an integer A. The second line has an integer B.

Output

Print all Armstrong numbers separated by a space.

If there are no Armstrong numbers in the given range, print -1.

Explanation

For

A = 150 and B = 200For example, if we take number 153, the sum of the cube of digits

1, 5, 3 is 13 + 53 + 33 = 153.

So, the output should be

153.

Sample Input 1

150

200

Sample Output 1

153

Sample Input 2

1

3

Sample Output 2

1 2 3




Smallest Missing Number


Given a list of numbers, write a program to print the smallest positive integer missing in the given numbers.


Input


The input will be a single line containing numbers separated by space.

Help me to do this not coimg correcr answer


Add two polynomials


Given two polynomials A and B, write a program that adds the given two polynomials A and B.


Input


The first line contains a single integer M.


Next M lines contain two integers Pi, Ci separated with space, where


Pi denotes power and Ci denotes co-efficient of Pi for polynomial A. After that next line contains a single integer N.


Next N lines contain two integers Pj, Cj separated with space, where Pj denotes power and Cj denotes co-efficient of Pj for polynomial B.

Please provide me a correct answer


Minimum Platforms

You are given arrival and departure times of all trains that reach a railway station. Find the minimum number of platforms required for the railway station so that no train is kept wait

Input

The first line contains space-separated integers that represent the arrival time of the trains.

The second line contains space-separated integers represent the corresponding end time of the trains.

Output

The output should have an integer that represents the number of platforms needed to arrange the commute of all the trains.

Explanation: The arrival times of 5 trains are

0900 0940 0950 1100 1500. The departure times of 5 trains are 0910 1200 1120 1130 1900.The first platform will be used to run the trains that arrive at

0900 0940 1500. The second platform will be used to run the trains that arrive at 0950.

Sample Input 1
0900 1100 1235
1000 1200 1240
Sample Output 1
1

Sample Input 2
0900 0940 0950 1100 1500
0910 1200 1120 1130 1900
Sample Output 2
3

please provide correct output.
Trapezium Order

you are given an integer N . print N rows starting from 1 in the trapexium order as shown in the output of the below examples .

Input

the input contains an integer N

OUTPUT

the output should have N lines

each of the N lines should have space -seperated integers as per the trapezium order

Sample input:
4

Sample output:
 1 2 3 4 17 18 19 20
  5 6 7 14 15 16
   8 9 12 13
    10 11

please provide the correct output and also correct spaces also given.

Please send corrected answer please for thisPolynomial


Given polynomial, write a program that prints polynomial in Cix^Pi + Ci-1x^Pi-1+...+ C1x + CO format.


Input


The first line contains a single integer N. Next N lines contain two integers Pi, Ci separated with space, where Pi denotes power and Ci denotes coefficient of Pi.



Given N number of days as input, write a program to convert N number of days to years (Y), weeks (W) and days (D).

Note: Take 1 year = 365 days.

Input
The input contains single integer N.

Output
Print space-separated integers Y, W and D.

Explanation
Given N = 1329. The value can be written as

1329 = 3 years + 33 weeks + 3 days

So the output should be 3 33 3.

Sample Input 1
1329
Sample Output 1
3
33
3
Sample Input 2
0
Sample Output 2
0
0
0
Samuel owns a shoe factory where there are N different machines operated for N different purposes. Each machine has its own motor. In order to avoid resonance, the rotation speed of any 2 machines should at least differ by 2 units. The rotation speed can only be in integer units and the maximum rotation speed of any motor is X units. Given minimum rotation speed of any motor to be 1 unit, you have to help Sam find out the number of different ways he can configure the speed of the motor. Input Specification: input1: N, denoting the number of machines. input 2X, denoting the maximum speed of the motor. Output Specification: Your function should return the total number of configuration modulus 10^4.
LATEST TUTORIALS
APPROVED BY CLIENTS