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.
The first line of input is a string.
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
The input contains single integer
Print space-separated integers
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
(2) Let X denote a random variable model with density function given by
Compute the
(i) expected value
(ii) standard deviation