Number of Numbers (10 pts)
Enter the number of numbers:
Enter the number of numbers: 4
Enter 4 numbers:
Number 1: 3.2
Number 2: 6.7
Number 3: 2.9
Number 4: 4.6
The sum of the numbers is: 17.4
And the product is: 286.0
Enter the number of numbers: 8
Enter 8 numbers:
Number 1: 2.1
Number 2: -5.6
Number 3: 9.0
Number 4: 8.7
Number 5: -2.2
Number 6: 8.2
Number 7: 9.5
Number 8: 1.4
The sum of the numbers is: 31.1
And the product is: 220931.3
**Please don't use format to do this one.
import java.util.Scanner;
import java.lang.Math;
public class Nums {
public static void main(String[] args) {
/* creating the scanner object */
Scanner s = new Scanner(System.in);
System.out.print("Enter the number of numbers: ");
/* scanning the length of array */
int n = s.nextInt();
/* declaring the integer array with the size n */
double arr[] = new double[n];
/* initializing the variables to store sum and product of elements of array */
double sum = 0;
double product = 1;
System.out.println("Enter " + n + " numbers:\n");
/* scanning the user input for array */
for (int i = 0; i < n; i++) {
/* scanning the array elements */
System.out.print("Number " + (i + 1) + " : ");
arr[i] = s.nextFloat();
/* calculating the sum and product of elements */
sum = sum + arr[i];
product = product * arr[i];
}
/* rounding the results to one decimal place */
sum = Math.round((sum) * 10.0) / 10.0;
product = Math.round((product) * 10.0) / 10.0;
/* displaying the result */
System.out.println();
System.out.println("The sum of the numbers is: " + sum);
System.out.println("And the product is: " + product);
}
}
![import java.util.Scanner; import java.lang.Math; 2 public class Nums 4 public static void main (String [] args) { /creating t](http://img.homeworklib.com/questions/ce59a2f0-98ff-11ea-9d19-cdaa05b3d88d.png?x-oss-process=image/resize,w_560)
![calculating the sum and product of elements */ 32 sum = sum + arr [i]; 33 product = product arr[i]: 34 35 36 / rounding the r](http://img.homeworklib.com/questions/cec21ab0-98ff-11ea-8234-1da15b414ac4.png?x-oss-process=image/resize,w_560)
o/p:

For help please comment.
Number of Numbers (10 pts) For this assignment you will be working with arrays. Open a...
1. Write a program that reads in two arrays (a1 and a2) of numbers and creates a new array (a3) of numbers such that the new array contains all the unique numbers of a1 and a2. Assume the input array elements are unique elements. In the main function, ask the user to enter the length of each array, declare and reads in the numbers for each array, and calculate and display the output array. Example input/output #1: Enter the length...
1. print mesage to user to prompt user to enter 10 numbers 2 have program accept 10 numbers from user and populate 10 occurrances of an array (use a loop to do this). 3. print message to user to advise user contents of array follows 4. have program display array contents (use loop to do this) end program comment in java please
need help!! c++
HW_6b - Calculate the average Use a do-while loop Write a program that first prompts the user for an upper limit: Enter the number of entries: 5 € (user enters 5) After the user enters a number, the program should prompt the user to enter that many numbers. For example, if the user enters 5, then the program will ask the user to enter 5 values. Use a do-while loop to add the numbers. o With each...
Using Java
In this assignment we are working with arrays. You have to ask the user to enter the size of the integer array to be declared and then initialize this array randomly. Then use a menu to select from the following Modify the elements of the array. At any point in the program, if you select this option you are modifying the elements of the array randomly. Print the items in the array, one to a line with their...
Assignment: Write a program that prompts the user to enter 10 numbers, and then displays the mean and standard deviation of these numbers I already have the source code all done. I just need this translated into a flowchart. Again I just need the flowchart, not any source code. I have already provided the source code below. Need Flowchart version of my code Here is the source code: public class Mean_Standard_Deviation { public static void main(String[] args) { ...
Ask uFor Ex. "Prompt user to enter a number" = user enters 10, your program should output 1, 2, 3, 4, 5, 6, 7, 8, 9, 10.ser to input a number, and then using a loop control statement (While, For, Do-While), output to the console the numbers beginning from 1, up to and including the number input by the user.
USE C++
2.) Write a program that will prompt the use to enter 10 numbers in an array, then display: the 1st, the 5th and the last number. Example, if the user entered 1 2 3 4 5 6 7 8 9 10, the output shall be: 1st is 1 5th is 5 last is 10
Write a program that reads integers ,one per line and displays their sum .Also display all the numbers read ,each with an annotation giving its percentage contribution to the sum. Use a method that takes the entire array as one argument and returns the sum of the numbers in the array. Hint: Ask user the user for the number of integers to be entered, create an array of that length ,and then fill the array with the integers read. A...
FUNCTIONS In this assignment, you will revisit reading data from a file, and use that data as arguments (parameters) for a number of functions you will write. You will need to: Write and test a function square_each(nums) Where nums is a (Python) list of numbers. It modifies the list nums by squaring each entry and replacing its original value. You must modify the parameter, a return will not be allowed! Write and test a function sum_list(nums) Where nums is a...
Write a C program with a filename netID_intarray.c that has 2 arrays. One is a two-dimensional array of strings which contains 5 words, each word can be a max of 20 characters long. The list of strings should be static in your code. The second integer array is populated by prompting the user for 10 integers to be stored in the array. Here is the simple output: $ ./run Number Work Enter integer 1 for the array: 45 Enter integer...