Significado aritmetico

La media aritmética, también llamada promedio o valor promedio, es la cantidad que se obtiene al sumar dos o más números o variables y luego dividir por el número de números o variables. La media aritmética es importante en estadística. 
Por ejemplo, digamos que solo hay dos cantidades involucradas, la media aritmética se obtiene simplemente sumando las cantidades y dividiendo por 2.

Algunos datos interesantes sobre la media aritmética: 

C++

// C++ program to find n arithmetic
// means between A and B
#include <bits/stdc++.h>
using namespace std;
 
// Prints N arithmetic means between
// A and B.
void printAMeans(int A, int B, int N)
{
    // calculate common difference(d)
    float d = (float)(B - A) / (N + 1);
 
    // for finding N the arithmetic
    // mean between A and B
    for (int i = 1; i <= N; i++)
        cout << (A + i * d) << " ";
}
 
// Driver code to test above
int main()
{
    int A = 20, B = 32, N = 5;
    printAMeans(A, B, N);
    return 0;
}

Java

// java program to illustrate
// n arithmetic mean between
// A and B
import java.io.*;
import java.lang.*;
import java.util.*;
 
public class GFG {
 
    // insert function for calculating the means
    static void printAMeans(int A, int B, int N)
    {
        // Finding the value of d Common difference
        float d = (float)(B - A) / (N + 1);
 
        // for finding N the Arithmetic
        // mean between A and B
        for (int i = 1; i <= N; i++)
            System.out.print((A + i * d) + " ");
    }
 
    // Driver code
    public static void main(String args[])
    {
        int A = 20, B = 32, N = 5;
        printAMeans(A, B, N);
    }
}

Python3

# Python3 program to find n arithmetic
# means between A and B
 
# Prints N arithmetic means
# between A and B.
def printAMeans(A, B, N):
 
    # Calculate common difference(d)
    d = (B - A) / (N + 1)
     
    # For finding N the arithmetic
    # mean between A and B
    for i in range(1, N + 1):
        print(int(A + i * d), end = " ")
 
# Driver code
A = 20; B = 32; N = 5
printAMeans(A, B, N)
 
# This code is contributed by Smitha Dinesh Semwal

C#

// C# program to illustrate
// n arithmetic mean between
// A and B
using System;
 
public class GFG {
 
    // insert function for calculating the means
    static void printAMeans(int A, int B, int N)
    {
        // Finding the value of d Common difference
        float d = (float)(B - A) / (N + 1);
 
        // for finding N the Arithmetic
        // mean between A and B
        for (int i = 1; i <= N; i++)
            Console.Write((A + i * d) + " ");
    }
 
    // Driver code
    public static void Main()
    {
        int A = 20, B = 32, N = 5;
        printAMeans(A, B, N);
    }
}
// Contributed by vt_m

PHP

<?php
// PHP program to find n arithmetic
// means between A and B
 
// Prints N arithmetic means
// between A and B.
function printAMeans($A, $B, $N)
{
     
    // calculate common
    // difference(d)
    $d = ($B - $A) / ($N + 1);
     
    // for finding N the arithmetic
    // mean between A and B
    for ($i = 1; $i <= $N; $i++)
        echo ($A + $i * $d), " ";
}
 
    // Driver Code
    $A = 20; $B = 32;
    $N = 5;
    printAMeans($A, $B, $N);
     
// This code is Contributed by vt_m.
?>

Javascript

<script>
 
// Javascript program to find n arithmetic
// means between A and B
 
// Prints N arithmetic means between
// A and B.
function printAMeans(A, B, N)
{
     
    // Calculate common difference(d)
    let d = (B - A) / (N + 1);
 
    // For finding N the arithmetic
    // mean between A and B
    for(let i = 1; i <= N; i++)
        document.write((A + i * d) + " ");
}
 
// Driver code
let A = 20, B = 32, N = 5;
printAMeans(A, B, N);
 
// This code is contributed by souravmahato348
 
</script>

Publicación traducida automáticamente

Artículo escrito por GeeksforGeeks-1 y traducido por Barcelona Geeks. The original can be accessed here. Licence: CCBY-SA

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *