#include <iostream>
using namespace std;
int main()
{
double num1, num2, avg, sum;
//use double instead of int because int only recognize whole numbers
cout<<"Enter a number: ";
cin>>num1;
cout<<"Enter a number: ";
cin>>num2;
sum=num1+num2;
avg=sum/2
cout<<" The average is: "<<avg;
system("pause");
return 0;
}
how to write a program that counts automorphic number from 1 to 999
6.38 is the average of the three numbers.
By learning how to program on C+.
You add the numbers together that you are trying to find the average of and then you divide it by how many numbers there are.Exampleto find the average of 67, 5 and 21 you plus them all together67+5+21=93then you divide the answer by three because there are 3 different number93÷3= 31
Initialise an unsigned integer to zero. As each number is input, increment the running total accordingly. When all numbers are input, display the total.
To find the mean average of 10 numbers requires the 10 number to be added together which will take 9 additions and then divide by the number of numbers which will take 1 division → 9 additions followed by 1 division, a total of 10 operations are nominally needed to find the mean average of 10 numbers.
To find the mean average of 20 numbers requires the 20 number to be added together which will take 19 additions and then divide by the number of numbers which will take 1 division → 19 additions followed by 1 division, a total of 20 operations are nominally needed to find the mean average of 20 numbers.
Just add the numbers, and divide the result by 3 (since there are 3 numbers).
#include<iostream> int main() { int i=0; while(i++<10) std::cout<<i*i<<std::endl; }
#includeint main(){int i;for(i=2;i
No. To find the average you:First, add up the numbers you have. For example, 2+4+6This equals 12.You then divide the 12 by how many numbers you started with.12 divided by 3 equals 4.
The mean of a set of numbers is the average. That is to say, all the numbers added together and divided by the number of the numbers. the answer is 30.5