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.
Printable View
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.
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
}
// 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;
}
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);
}