Program to find average of sales in a week using array in C++

Using Visual Studio 2015

===============================================================

#include<iostream>
using namespace std;
#include<conio.h>
void main()
{
 const int size=7;
 double arr[size],total=0,average;
 for (int i = 0;i < size;i++)
 {
  cout<<"Enter number "<<i<<"=";
  cin>>arr[i];
 }
 for (int j = 0;j < size;j++)
 total+=arr[j];
 average=total/size;
  cout<<"Average="<<average;
 _getche();
}



===========================================================================

Comments

Popular posts from this blog

Suppose you are given a square matrix of size n x n, write a program to determine if this is an identity matrix. 2D array

Program to create a multiplication table of a given number using while loop.

Program to find equal values using if statement in C++