#1
 BoanHed Member Join Date: Feb 2006 Posts: 185
Calculate Average in C program

I want to make a C program with a graphical interface that must be composed of 11 numbers (averages) with a "calculate" button that allow the calculation of the number.
#2
 Walby Member Join Date: Jan 2009 Posts: 199
Re: Calculate Average in C program

Code:
```for(j = 0, j < 11, j++)
{
do
{

}  while
F[j] = input;
sum += input;
}
if(sum != 1.0)

else
{
for(j = 0; j < 11, j++)
Avg += (F[j]*X[j]);
Avg /= 11;
// output Avg
}```
#3
 Zecho Member Join Date: May 2008 Posts: 2,293
Re: Calculate Average in C program

// Calculating the average
Code:
```#include <iostream>
using namespace std;

int main()
{
cout << "Enter the number: ";
int i;
cin >> i;
double num;
double sumnum;
sumnum = 0.0;
for (int y = 1; y <= i; y++)
{
cout << "#" << x << " = ";
cin >> num;
sumnum += num;
}```
#4
 Aberto Member Join Date: Dec 2008 Posts: 177
Re: Calculate Average in C program

Code:
```#include <stdio.h>

float average(float z, float d) {
return (z + d)/2.0f;
}

/* main program - execution always starts here */
void main() {

float average(float x, float y);  /* Function prototype */

float val1= 1.0F;
float val2 = 2.0F;
float o = 0.0F;

o = average(val1, val2);
printf("\nThe average is: %f",  o);
}```

 Tags:

 Thread Tools Search this Thread Show Printable Version Email this Page Search this Thread: Advanced Search Similar Threads for: "Calculate Average in C program" Thread Thread Starter Forum Replies Last Post Need help to calculate Average of time in Microsoft Excel NardO MS Office Support 2 23-02-2012 05:06 PM How to calculate the average time in excel Rao's Windows Software 1 06-01-2012 10:48 PM How to calculate Highest Average marks using c++? Madaleno Software Development 5 16-02-2010 09:25 PM Program : How to calculate the median in C++? UseME Software Development 3 19-01-2010 12:08 PM What is the Program to calculate the percentage? Ekpah Software Development 3 08-12-2009 12:30 PM

All times are GMT +5.5. The time now is 12:27 PM.