gram
gram
gram
gram

# Macronutrients

Fats, proteins and carbohydrates are macronutrients and thus provide energy. Energy is measured in calories. The amount of energy in 1 gram differs between macronutrients:

• Fat has 9 calories per gram.
• Protein has 4 calories per gram.
• Carbohydrates have 4 calories per gram.
Carbohydrates may partially consist of Dietary Fiber. Dietary fiber can not be digested and thus should be subtracted from the total Carbohydrates.

# The formula

(Fat x 9) + (Protein x 4) + ( (CarbohydratesDietary Fiber) * 4) = Total Calories

###### Example:

(1 x 9) + (1 x 4) + ( (354) * 4) = 137

# BMR

To find out how many calories you require a day with different levels of activity, please refer to the BMR (Basal Metabolic Rate) Calculator.

# How to Calculate Average (Arithmetic Mean)

To calculate the average of a group of numbers, all one must do is add all the numbers up and then divide by the total amount of numbers.

Let’s take the following numbers for example:

`6, 5, 4, 3`

The sigma of 1 through n – or the sum of all the numbers is 18.

`6 + 5 + 4 + 3 = 18`

The n – or the total count of numbers is 4.
18 divided by 4 is 4.5.

`18 / 4 = 4.5`

It’s easy. Here, you can try it yourself.
``` function calcAvg(){ var string = document.getElementById('numbers').value; var array = string.split(','); var sum = 0; for (index = 0; index < array.length; ++index) { var myx = parseFloat(array[index]); if(isNaN(myx )){ alert(myx + ' is not a number. Please enter comma separated numbers only.'); return false; } sum = sum + myx ; } var avrg = sum / array.length; var result = document.getElementById('result').value; var msg = ''; if(avrg == parseFloat(result) ){ msg = 'Correct!'; }else{ msg = 'Incorrect, the average is ' + avrg + '.'; } document.getElementById('answer').innerHTML = msg ; } Enter your comma separated numbers here: Enter your calculation result for the average here: ```

``` ```