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

Write a C++ program that creates a one dimensional array with of length 5 elements. Your
program should read an integer from the keyboard and test if it is prime. If the integer is
prime, the program should insert the integer into the 3rd index of the array�
Write a C++ program that creates a one dimensional array with of length 5 elements. Your
program should read an integer from the keyboard and test if it is prime. If the integer is
prime, the program should insert the integer into the 3rd index of the array�

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




Composite Numbers in the range

You are given two integers M, N as input. Write a program to print all the composite numbers present in the given range (including M and N).

Input

The first line of input is an integer M. The second line of input is an integer N.

Explanation

In the given example, the composite numbers present in the range between

2 to 9 are 4, 6, 8, 9.So, the output should be


4

6

8

9


Sample Input 1

2

9

Sample Output 1

4

6

8

9

Sample Input 2

1

4

Sample Output 2

4




Kth largest factor of N

Write a program to find the Kth largest factor of a number N.

Input

The first line is an integer N. The second line is an integer K.

Output

Print Kth largest factor of N. Print 1, If the number of factors of N is less than K.

Explanation

For

N = 12 and K = 3 The factors of 12 are 1, 2, 3, 4, 6, 12. The 3rd largest factor is 4.For

N = 12 and K = 7 The number of factors for 12 is only 6 and the given K is 7 (no of factors of N < K). Hence the output should be 1.

Sample Input 1

12

3

Sample Output 1

4

Sample Input 2

12

7

Sample Output 2

1




Replacing Characters of Sentence

You are given a string S. Write a program to replace each letter of the string with the next letter that comes in the English alphabet.

Note: Ensure that while replacing the letters, uppercase should be replaced with uppercase letters, and lowercase should be replaced with lowercase letters.

Input

The first line of input is a string.

Explanation

In the given example,

Hello World.

If we replace each letter with the letter that comes next in the English alphabet,

H becomes I, e becomes f and so on ... So, the output should be

Ifmmp Xpsme.

Sample Input 1

Hello World

Sample Output 1

Ifmmp Xpsme

Sample Input 2

Something is better than Nothing

Sample Output 2

Tpnfuijoh jt cfuufs uibo Opuijoh




Years, Weeks & Days

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.

using basic python


A B C D E

Now perform the following operations on the Dequeue

(a) Add F on the left

(b) Add G on the right

(c) Add H on the right

(d) Delete two letters from the left

(e) Add I on the right

(f) Add J on the left

(g) Delete two letters from right


Problem Description :

The function accepts two positive integers ‘r’ and ‘unit’ and a positive integer array ‘arr’ of size ‘n’ as its argument ‘r’ represents the number of rats present in an area, ‘unit’ is the amount of food each rat consumes and each ith element of array ‘arr’ represents the amount of food present in ‘i+1’ house number, where 0 <= i

Note:

Return -1 if the array is null
Return 0 if the total amount of food from all houses is not sufficient for all the rats.
Computed values lie within the integer range.
Example:

Input:

r: 7
unit: 2
n: 8
arr: 2 8 3 5 7 4 1 2

(2) Let X denote a random variable model with density function given by

   

Compute the 

(i) expected value                   

(ii) standard deviation



LATEST TUTORIALS
APPROVED BY CLIENTS