Ordered Matrix
Given a M x N matrix, write a program to print the matrix after ordering all the elements of the matrix in increasing order.
Input
The first line of input will contain two space-separated integers, denoting the M and N.
The next M following lines will contain N space-separated integers, denoting the elements of each list.
Output
The output should be M lines containing the ordered matrix.
Note: There is a space at the end of each line.
Explanation
For example, if the given M is 3 and N is 3, read the inputs in the next three lines if the numbers given in the next three lines are the following.
1 20 3
30 10 2
5 11 15By ordering all the elements of the matrix in increasing order, the ordered matrix should be
1 2 3
5 10 11
15 20 30Sample Input 1
3 3
1 20 3
30 10 2
5 11 15
Sample Output 1
1 2 3
5 10 11
15 20 30
Sample Input 2
2 5
-50 20 3 25 -20
88 17 38 72 -10
Sample Output 2
-50 -20 -10 3 17
20 25 38 72 88
String Rotation
Given two strings(S1 and S2), write a program to determine if a string S2 is a rotation of another string S1.
Input
The first line of the input will be a string S1.
The second line of the input will be a string S2.
Output
If string S2 is a rotation of another string S1, print number of right rotations made by string S1 to match the string S2. Otherwise, print "No Match".
Where right rotation means all elements are moving towards the right side by one place where the last element will be placed in the first place example, one right rotation of "python" is "npytho".
Explanation
For example, if the given strings S1 and S2 are "python" and "onpyth",
The first right rotation of s1 is "npytho" which is not equal to string S2"onpyth"
The second right rotation of s2 is "onpyth" which is equal to string S2 "onpyth".
So the output should be 2
Sample Input 1
python
onpyth
Sample Output 1
2
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.
Output
The output should be a single line containing the smallest missing number from given numbers.
Explanation
For example, if the input numbers are 3, 1, 2, 5, 3, 7, 7.
The number 1, 2, 3 are present. But the number 4 is not. So 4 is the smallest positive integers that is missing from the given numbers.
Sample Input 1
3 1 2 5 3 7 7
Sample Output 1
4
Sample Input 2
5 5 2 3 1 8 8 4
Sample Output 2
6
New Year Countdown
Given date-time D, write a program to print the time left for the next New Year.
Input
The input will be a single line containing the date-time in the string format similar to "Dec 30 2020 02:43 PM".
Output
The output should be a single line containing hours and minutes left for the next new year in the format similar to "33 hours 17 minutes".
Explanation
For example, if the given date-time is "Dec 30 2020 02:43 PM", the difference between "Dec 30 2020 02:43 PM" and "Jan 1 2021 00:00 AM" is 1 day 9 hours 17 minutes. The difference in hours and minutes is 1 * 24 + 9 hours and 17 minutes. So the output should be "33 hours 17 minutes".
Sample Input 1
Dec 30 2020 02:43 PM
Sample Output 1
33 hours 17 minutes
Sample Input 2
Jan 31 2020 04:43 AM
Sample Output 2
8059 hours 17 minutes
4. Write a C++ program that
1) prompts the user to input 3 decimal numbers (with a fraction part)
2) Prints the three decimal numbers.
3) Converts each decimal number to the nearest integer.
4) Prints the three converted numbers.
What is printed by the following code?
#include <iostream>
#include <math.h>
using namespace std;
int main(int argc, const char * argv[]) {
// insert code here...
double Num1, Num2;
cout << "Please enter two float number : ";
cin >> Num1 >> Num2;
double average = (Num1 + Num2)/2;
cout << "The average between these number is :m" <<average << endl;
cout << "The nearest integer around the average is : " << round(average)<<endl;
return 0;
write a C++ program that prompt user to input a character and convert the character to the ASCII number
Weekends
Given two dates D1 and D2, write a program to count the number of Saturdays and Sundays from D1 to D2 (including D1 and D2).
The date in string format is like "8 Feb 2021".
Input
The first line of input will contain date D1 in the string format.
The second line of input will contain date D2 in the string format.
Output
The output should be a single line containing two integers separated by space.
Explanation
For example, if the given dates are "25 Jan 2021" and "14 Feb 2021", the Saturdays and Sundays dates from "25 Jan 2021" to "14 Feb 2021" are
"30 Jan 2021" is a Saturday
"31 Jan 2021" is a Sunday
"6 Feb 2021" is a Saturday
"7 Feb 2021" is a Sunday
"13 Feb 2021" is a Saturday
"14 Feb 2021" is a Sunday
So the output should be
Saturday: 3
Sunday: 3
Sample Input 1
25 Jan 2021
14 Feb 2021
Sample Output 1
Saturday: 3
Sunday: 3
Describe the problem analysis-coding-execution cycle
The user must also have the ability to update specific details of the product. For example, the user must first enter the product code and then confirm whether to update the following product details:
•Update the product warranty.
•Update the product price.
•Update the product stock level