Write a do-while loop that repeatedly prompts for and intakes input until a negative value is entered. The program will end and display the average of the values entered once a negative value is entered.
You need to find which digit occurs most number of times across the four given input numbers.
input1, input2, input3 and input4 are the four given input numbers.
The program is expected to find and print the most frequent digit.
Example1 –
If input1=123, input2=234, input3=345, input4=673
We see that across these four numbers,
1, 5, 6 and 7 occur once,
2 and 4 occur twice, and
3 occurs four times.
Therefore, 3 is the most frequent digit and so the program must print 3
NOTE: If more than a digit occurs the same number of most times, then the smallest of those digits should be the result. Below example illustrates this.
Example2 –
If input1=123, input2=456, input3=345, input4=5043
We see that
0, 1, 2 and 6 occur once, and
3, 4 and 5 occur thrice.
As there are three digits (3, 4 and 5) that occur most number of times, the result will be the smallest (min) digit out of these three. Hence, the result should be 3
Implement a C++ program to overload the function named as sum, to perform sum of digits of integer and perform sum of digits of float number respectively.
write a python program to add two polynomials.
Polynomial1 = 6x^3 + 10x^2 + 5
Polynomial2 = 4x^2 + 2x + 1
output
6x^3 + 14x^2 + 2x + 6
NOTE: Use string formatting to Display the Output
Make two 2D-points, points in cartesian plane. Calculate the distance between these points.
1. Write a C++ program that calculates the right triangle's hypotenuse c=√a+b
2. Do include the header file < cmath >
3. Run the code.
4. Make sure you save your code and take a screenshot of both the code and the results.
Given a sentence S, write a program to print the frequency of each word in S. The output order should correspond with the word's input order of appearance.
Given a list of integers, write a program to identify the contiguous sub-list that has the largest sum and print the sum. Any non-empty slice of the list with step size 1 can be considered as a contiguous sub-list.
Write a program to print the anti-diagonal elements in the given matrix.
String Slicing
Given two strings
inputString and subString as inputs, write a JS program to slice the inputString if it includes the subString. Slice the inputString starting from the subString to the end of the inputString.
Input
The first line of input contains a string inputString
The second line of input contains a string subString
Output
The output should be a sliced string or inputString (if the inputString does not include the subString)
Sample Input 1
JavaScript
S
Sample Output 1
Script
Sample Input 2
Language
air
Sample Output 2
Language