4+7+5+6+8=30
30 is the only sum those numbers can add up to.
// numbers to work with double[] nums = {1, 2, 3, 4.5, 5.5, 6, 7.5, 8, 9, 10}; double sum = 0; // total sum for (int i = 0; i < nums.length; ++i) { sum += nums[i]; } // final average final double mean = (sum / nums.length);
Borrowing the isPrime function from another answer of mine. Note that this will result in terrible performance for large arrays of numbers. (You should look into one of the sieve algorithms for this) // returns 1 if n is prime, 0 otherwise void isPrime(const int n) { // We know that if n is composite, then we will find a factor in the range [2,sqrt(n)] // so we compute the square root only once to limit our number of calculations. const int sqrt_n = sqrt(n); // Iterate through possible factors int i; for( i = 2; i <= sqrt_n; ++i ) { // If n is divisible by i (n%i==0) then we have a factor if(!(n % i)) { return 0; } } // If we get here, we know n has no factors other than itself and 1 return 1; } // returns the sum of all prime numbers in nums int findPrimeSum(const int numsLength, const int[] nums) { int sum = 0; // iterate through nums and add up all the primes int i; for(i = 0; i < numsLength; ++i) { if( isPrime(nums[i] ) { sum += nums[i]; } } return sum; }
The sum of the probabilities of all possible outcomes is 1.
what is the least possible sum of two 4-digit numbers?what is the least possible sum of two 4-digit numbers?
It depends on the sum, but yes, it is possible.
C12H18O2 is not a mathematical expression, not is it a sum so there is no sensible answer possible.
The largest possible sum with 2 six sided dice is 12.
1601
The sum can be any number from 2 to 12.That's 11 possible outcomes.
No
No
The sum is 154.