Arithmetic Mean Program in C++1 min read

We will write a C++ Program to Calculate Arithmetic Mean. Before that, you should have knowledge of the topics in C++ given below.

Arithmetic mean is the sum of a collection of numbers divided by the number of numbers in the collection. For example:

arithmetic mean = (n1 + n2 +n3 + ... + nn)/n

The program takes a number as an input from the user whose arithmetic mean is to be calculated. Then iterating that number through a for loop, we will calculate the sum of the number and then finally calculate the mean of the result of the sum of the number.

Lastly, display the arithmetic mean of the entered number in C++.


Arithmetic Mean Program in C++

There is a use of an array to store the numbers entered by the user.

Output:

How many number you want to enter?: 4
Enter 4 Number:
2
3
4
1
Arithmetic Mean: 2

Also, you can change the data type according to your need. It could be float, double, etc.


MORE

String Pattern Programs in C

In this tutorial, we will write various C pattern programs for String. Before that, you may go through the following topics in C. for loop …
Read More

Java Program to Find pair of Integers in Array whose sum is given Number

In this tutorial, we will write a program to find a pair of elements from an array whose sum equals a given number in java …
Read More

Program to Print Diamond Alphabet Patterns in C

In this tutorial, we will learn to write a C program to print Diamond patterns using alphabets/characters. However, in this tutorial, we will create a …
Read More

Half Diamond Pattern in C using Alphabets

In this tutorial, we will learn and code the half diamond alphabet patterns in C programming language. However, in this tutorial, we will create a …
Read More

Half Pyramid of Alphabets in C

In this tutorial, we will learn and code alphabet patterns in C programming language specifically the Half pyramid of alphabets in C programming. However, in …
Read More

Inverted Half Pyramid Pattern of Alphabets in C

In this tutorial, we will write a C program to print half Pyramid using alphabets/characters. Before that, you may go through the following topic in …
Read More