https://github.com/ozzies-code/mediac
The C Program calculates the mean or average of 6 numbers, to process and calculate the average value, the While loop is used until all the numbers have been processed for the calculation.
https://github.com/ozzies-code/mediac
Last synced: 2 months ago
JSON representation
The C Program calculates the mean or average of 6 numbers, to process and calculate the average value, the While loop is used until all the numbers have been processed for the calculation.
- Host: GitHub
- URL: https://github.com/ozzies-code/mediac
- Owner: ozzies-code
- Created: 2023-07-30T22:51:18.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-07-30T22:56:21.000Z (almost 2 years ago)
- Last Synced: 2025-01-21T12:13:08.000Z (4 months ago)
- Language: C
- Size: 17.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# MediaC
The C Program calculates the mean or average of 6 numbers, to process and calculate the average value, the While loop is used until all the numbers have been processed for the calculation.
/*Calculo de la media de 6 numeros*/
#include
#include
int main(int argc, char *argv[])
{
const int TotalNum = 6;
int ContadorNum = 0;
float SumaNum = 0;
float media;printf("Introduzca %d numeros\n", TotalNum);
while(ContadorNum < TotalNum)
{ /*Valores a Procesar*/
float numero;
scanf("%f", &numero); /* Leer siguiente numero*/
SumaNum += numero; /* Anadir valor a Acumulador */
++ContadorNum; /* Incrementar numeros leidos */
}
media = SumaNum/ContadorNum;
printf("Media: %.2f \n", media);
system("PAUSE");
return 0;}