average

How to manipulate arrays. Find the average. Beginner Java

帅比萌擦擦* 提交于 2019-12-28 04:05:07
问题 I have a homework assignment and I was wondering if anyone could help me as I am new to Java and programming and am stuck on a question. The question is: The first method finds the average of the elements of an integer array: public double average(int[] data) That is, given an integer array, data, calculate the average of its elements are return the average value. For example, the average of {1, 3, 2, 5, 8} is 3.8. Here is what I have done so far: public double average(int[] data) { int sum =

Inputing integers straight across in C

喜你入骨 提交于 2019-12-27 01:46:20
问题 I'm in a beginner C course and I was wondering if there's a way to input integers straight across and averages them together? I'm trying to make my program nice and tidy as possible. I want to input integers straight across like: Enter the temperatures and Enter 00 when finished: 60 80 97 42 Average is: 69.75 I don't want to input integers like shown below: Enter the temperatures and Enter 00 when finished: 75 Enter the temperatures and Enter 00 when finished: 80 Enter the temperatures and

How to create list from 100 elements to list of 10 [duplicate]

故事扮演 提交于 2019-12-25 18:53:53
问题 This question already has answers here : What is the most “pythonic” way to iterate over a list in chunks? (35 answers) Closed 4 months ago . I have small brain fade today and I believe it will be faster to get hint here than wondering for an hour. I have list A of 100 elements. How can I create another list(B) basing on list A, that will have 10 elements, so that each element is mean of 10 elements from list A? Thank you in advance. e.g. A = [10,10,10,10,10,20,20,20,20,20,30,30,30,30,30,40

Finding the min max and average of an array

南笙酒味 提交于 2019-12-25 16:09:09
问题 I need to find the min, max, and average of the balances. I have done this before using for loops, but never with a while loop. Is there a way to pull the min max and average straight from the array without interfering with the while loop perhaps? 10 Helene 1000 Jordan 755 Eve 2500 Ken 80 Andrew 999 David 1743 Amy 12 Sean 98 Patrick 7 Joy 14 where 10 is the number of accounts import java.util.*; import java.io.*; import java.util.Arrays; public class bankaccountmain { public static void main

C# how to average a array input

做~自己de王妃 提交于 2019-12-25 14:38:09
问题 I Have the first part of my code pretty complete and I got the gist of the rest, I'm just not sure how to put it all together. Here is the first part using System; namespace ConsoleApplication1 { class Program { public class AccountInfo { public int Number { get; set; } public double Balance { get; set; } public string LastName { get; set; } } static void Main(string[] args) { List<AccountInfo> accounts = new List<AccountInfo>(); for (int index = 1; index < 6; index++) { AccountInfo acc = new

MS Access - SQL Query for Average of Each Day Data

巧了我就是萌 提交于 2019-12-25 08:33:38
问题 I have a set of data spanning across 3 days. Based on the first column from the left, is it possible to have a query that calculates the average of the values in the third column from the left based on each day? The end result will be two columns: 1/1/2008 | 1.605 2/1/2008 | 1.59 3/1/2008 | 1.56 I think the logic will be something like in a loop: Based on the day in the first column, if it is the same day, count the number of rows and add up the values of the third column Use the sum of the

error: name lookup of 'i' changed for ISO 'for' scoping

不羁岁月 提交于 2019-12-25 06:58:50
问题 I have looked at other topics similar to this and still cannot find out what is wrong with my code. The following is a function in my program to find the Mean (Average) of Arrays. I get the error in the title: error: name lookup of 'i" changed for ISO 'for' scoping. following with note: if you use '-fpermissize' g++ will accept your code. double GetMean ( double Array[], int ArrayLength ) { int Sum, Mean; for ( int i = 0; i < ArrayLength; i++ ) { Sum = Sum + Array[i]; } Mean = Sum / Array[i];

average of an array of data vba excel

和自甴很熟 提交于 2019-12-25 06:55:49
问题 I'm new in this stuff of programming. I'have been searching for this topic and I can't find anything that fits to my problem. I have an array of data with measures. I have 31 lines and 96 columns. I want that my VBA code finds the average of each column of data and displays it on the line after the last value of the column. Can anybody help me? Thanks in advanced. 回答1: The easiest answer I've found is to use the following: Application.WorksheetFunction.Average(dataArray) This is

Find average, maximum and minimum values of values entered

旧城冷巷雨未停 提交于 2019-12-25 02:56:00
问题 The first part of the question is to write a program that: prompts user to enter integer values and keep a running total. #include<iostream> using namespace std; int main() { int n, sum = 0; while(n != 0) { cout << "Enter number :"; cin >> n; if(n <= 0) break; sum += n; } and the second part is: Modify the previous program to print out the largest and smallest number read in as well as the average. Also change the prompt to show the number of numbers still to be entered. #include<iostream>

Trying to calculate highest marks with name in python

◇◆丶佛笑我妖孽 提交于 2019-12-25 02:43:22
问题 grade=[] names=[] highest=0 cases=int(input('Enter number of cases: ')) for case in range(1,cases+1): print('case',case) number=int(input('Enter number of students: ')) for numbers in range (1,number+1): name=str(input('Enter name of student: ')) names.append(name) mark=float(input('Enter mark of student:')) grade.append(mark) print('Case',case,'result') print('name',list[list.index(max(grade))]) average=(sum(grade)/number) print('average',average) print('highest',max(grade)) print('name'