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.Write a program that asks the user to enter three positive integer value; number, start, end and
Silicon Value, and then prints the Silicon table of the number from the starting number to the ending
number. After printing the table, our program should ask the user whether he or she wishes to perform
the operation again. If so, the loop should repeat; otherwise it should terminate.
Use a character input of y or Y to repeat, and n and N to terminate the loop. No break statement is
allowed.
NOTE: Perform input validation so that all numbers must be greater than 0 and the “start” number
should be less than “end” number.
NOTE: Silicon Number is multiplied with iteration counter as shown in the table below
:
Enter a number: 5
Enter starting value: 3
Enter ending value: 7
Enter silicon value: 9
Silicon Table:
5 * 3 * 9 = 135
5 * 4 * 18 = 360
5 * 5 * 27 = 675
5 * 6 * 36 = 1080
5 * 7 * 45 = 157
Enter a number: 6
Enter starting value: 5
Enter ending value: 6
Enter silicon value: 8
Write a program that asks the user to enter three positive integer value; number, start, end and
Silicon Value, and then prints the Silicon table of the number from the starting number to the ending
number. After printing the table, our program should ask the user whether he or she wishes to perform
the operation again. If so, the loop should repeat; otherwise it should terminate.
Use a character input of y or Y to repeat, and n and N to terminate the loop. No break statement is
allowed.
NOTE: Perform input validation so that all numbers must be greater than 0 and the “start” number
should be less than “end” number.
NOTE: Silicon Number is multiplied with iteration counter as shown in the table below.
Question-1 [10 Points]
Write a program that prompts the user for an integer and then prints out all coward numbers up to
that integer. For example, when the user enters 20, the program should print: 3 4 6 8 12 14 18 20.
Recall that a number is a prime number if it is not divisible by any number except 1 and itself.
Hint: Use Nested Loop to solve this problem. Outer Loop iterations must start from 3 and ideally inner
loop iterations must start from 2.
Coward Number: Number whose previous number is not divisible by any number other than 1
and number itself.
Instructions:
1. Create a program called CowardNumbers.java.
2. Create appropriate variables and assign values using a Scanner object.
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.