mean
given a list of integers,write a program to print the mean
mean - the average value of all the numbers.
input
the input will be a single line of containing space-separated integers.
output
the first line of output should contain the mean, round off the value to 2 decimal places.
mean should always be a float value.
mean should be a float value when there are even number of elements, otherwise should be an integer value.
see sample input/output for the output format
explanation
for example, if the given list of integers are
2 4 5 6 7 8 2 4 5 2 3 8
the average of all the numbers is 4.67.
after sorting the array,
2 2 2 3 4 4 5 6 7 8 8
DOM.
image:
https://res.cloudinary.com/dfxicv9iv/image/upload/v1619260598/dynamic-dom-manipulations-3_bov0vg.gif
Delete btn is clicked
The blog element &the respective btn shouldbe deleted.
fill script code:
let blgList = [{
blgName:"TechCrunch",
uniqueNo:1,
},
{
blgName:"Wired",
uniqueNo:2,
}
];
let blgsListContainer = document.getElementById("blogsListContainer");
function createAndAppendItem(blg) {
let blgId = "blog" + blg.uniqueNo;
let btnId = "button" + blg.uniqueNo;
let blgEl = document.createElement("li");
blgEl.id = blgId;
blgEl.textContent = blg.blgName;
blgsListContainer.appendChild(blgEl);
let btnEl = document.createElement("button");
btnEl.classList.add("btn", "btn-danger", "ml-3");
btnEl.textContent ="Delete";
btnEl.id = buttonId;
// Write your code here
blgEl.appendChild(btnEl);
}
for (let blg of blgList) {
createAndAppendItem(blg);
}
Identifies different types of Computer Users in details.
Describe computer oriented society and write down the benefits and drawbacks of computer oriented
societies in details
If P is pressed, ask the user to type his rate (pay) per hour and the number of hours he worked for the entire month separated by a space. Then, display his name and wage.
storing the input to the next variable name based on data type
For String s.nextLine()
For int s.nextInt()
For double: s.nextDouble()
Write a C++ program that prompts a user for three integers- the first denoting a month (1 to 12), the second denoting a day (1 to 31) and the third denoting a year. The output is displayed as "month day, year" string where month represents the name of the month.
For example, if inputs are 12, 15 and 2020 respectively, the output is December 15,
Write a program in C++ that reads text from the keyboard and stores it in a file named “File1.txt”. Also, for each of the specified prototypes given below, write the function definitions.
void copyselc(ifstream& fp, ofstream& fp1):This function reads the contents of the file “File1.txt” and copies those lines from the file that begin with the character „#‟ to the file named “File2.txt”.
void checksize(ifstream& fp1,ifstream& fp2):This function reads two files “File1.txt” and “File2.txt” and counts the number of characters in both the files. If the count of characters in both the files is same, then the function should print the message “Both Files are of the same size” else it should display “Size of the files is not same”.
void dispNumNames(ifstream& fp):Assuming that the file “File2.txt” may also contain numbers (1 to 5), this function will read the contents from the file and display the number names for any numbers encountered.
Write C++ code for the following tasks:
Write a prototype for the function named fsum() that accepts two parameters: an array A of integer pointers and a variable x of type double. The return type of this function is int. Store three integer values entered as command line arguments in an integer array A.
Insert the string “ Offline” after the first occurrence of character „o‟ in the string s1= “Hello World”. Also, print the ASCII value of each character in this modified string after insertion.
Define a function replace() that receives an integer number as parameter and replaces it with a number formed by rearranging the digits of the original number. The return type of the function is void.
Define a class A that declares a static variable count of type integer. Initialize the value of count to zero. Use the variable count to count the number of objects of the class A.
Write a program in C++ that defines a class named StringOps. Declare data members of
this class as described below:
variable str of data type string.
variable size of data type integer which represents the length of the string str.