Use the following functions:
int sum (const int* const a, const unsigned size) {
int s = 0;
for (unsigned i=0; i<size; ++i) s += a[i];
return s;
}
double average (const int* const a, const unsigned size) {
return (double) sum (a, size) / size;
}
Example usage:
int main () {
int[3] a = {74, 42, 64};
printf ("Sum = %d\n", sum (a, 3)); // Sum = 180
printf ("Average = %d\n", average (a, 3)); // Average = 60.0
return 0;
}
create a program that iterates until it finds a perfect number, then store that perfect number into an array. Continue iterating until you find three more. Then, you have an array of four perfect numbers.
Cls input "enter two no.s ",a,b sum=a+b print "sum = ";sum end
#include <iostream>02using namespace std; 03 04int main() 05{ 06 int sum = 0; 07 int average = 0; 08 int array[10] = {1,2,3,4,5,6,7,8,9,10}; 09 for (int i = 0; i < 10; ++i) 10 sum+=array[i]; 11 average = sum/10; 12 cout<<"Average:"<<average; 13}
write a shell program for finding out gcd of three given numbers? write a shell program for finding out gcd of three given numbers? write a shell program for finding out gcd of three given numbers? check bellow link http://bashscript.blogspot.com/2009/08/gcd-of-more-than-two-numbers.html
To calculate the average of two numbers, add them together, and divide the result by 2. (For the average of three numbers, you add up the three numbers, and divide by three, etc.) The average is (5000 + 7000)/2 = 6000
125, 126 and 127.
Yes. For example, the average of 5, 7, and 9 is 7.
3, 5, and 7 are three prime numbers whose average is 5.
The average of the numbers 51, 52, and 56 is 53. To get the average you would add all three numbers and then divide by three.
12
The average number of publications for PhD candidates in our program is three.
3, 5, and 7 are three prime numbers whose average is 5.