Mr. Umar throws two dice multiple times. Every time he throws the first dice it shows the value 3 and the value of the second dice varies. He will get some coupons if the sum of the two dice value is even. Assuming the first dice value is 3, the result can be computed as sum=3+x, x varies from 1 to 6. The possible sum values would be 4, 5, 6, 7, 8, 9. If the sum is 4 then he will get movie tickets, if the sum is 6 then he will get a lunch coupon, if the sum is 8 he will get amazon prime coupon. Any other value he will not be eligible for any coupon.
Requirements
Depending on the result display the appropriate coupon Mr. Umar gets
You are given a positive integer N. Your task is to find the number of positive integers K <= N such that K is not divisible by any of the following numbers 2, 3, 4, 5, 6, 7, 8, 9, 10.
In the given example,
11 is not divisible by any number from 2 to 10. It is divisible by only 1, 11.So, the output should be
2.
A student comes to take the admission for the hostel, Provided there are two hostels for girls and boys separately, Allotment has to be done for each student based on type of room i.e, number of sharing. For girls, only three sharing is available but for boys both two and three sharing is available. Given 8,000 for 3 sharing per month and 10,000 for 2 sharing per month.Following are the requirements: 1. Capture the Gender, Type of room, duration of stay(in months) 2. If gender is female/girls, Allotment can be done only with type of room as 3 sharing 3. If gender is male, allotment can be done with type of room as both 2 sharing and also 3 sharing. For two sharing, Amount is 10,000 per month per student and for 3 sharing, Amount is 8000 per month per person. 4. Compute the total Cost( Cost = Amount*duration) for both girls(3 sharing) and boys(2 and 3 sharing) 5. Display the Cost.
Given a MxN matrix, write a program to replace all elements that do not belong to principal-diagonal & anti-diagonal with Zeros.
Principal-diagonal elements are the set of elements of a matrix that lie on the line joining the top left corner to the bottom right corner.
Anti-diagonal elements are the set of elements of a matrix that lie on the line joining the bottom left corner to the top right corner.Input
The first line of input will contain two space-separated integers, denoting MxN matrix.
The next M lines will contain N space-separated integers.Output
The output should be MxN matrix by replacing elements that do not belong to principal-diagonal and anti-diagonal with Zeros. Print each row as a space separated integers in a single line.
input:5 5
4 3 7 6 4
4 4 7 7 6
9 5 8 5 9
3 6 6 2 4
3 7 4 4 3
output should be like this:4 0 0 0 4
0 4 0 7 0
0 0 8 0 0
0 6 0 2 0
3 0 0 0 3
Ask the user to enter three of their favourite television shows. Once they have entered there shows, display the results. Use an array to store the three television shows
Write a c++ program to implement the following . Assuming that a text file named first.txt contains some text written into it .write a function named vowelwords(), that reads the file first.txt and creates a new file named second.txt ,to contain only those words from the file first.txt which start the lowercase vowel (a,e,i,o,u).
For m = 6 and n = 5, write a C++ code to accomplish the above
Given an integer N as a starting number and K as input, write a program to print a number pyramid of K rows as shown below.
In the example, the given starting number is
10, and the number of rows in the pyramid is 5.So, the output should be
24
23 22
21 20 19
18 17 16 15
14 13 12 11 10