Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main()
- {
- //un arreglo es una colección de elementos del mismo tipo
- //tiene un solo nombre "notas"
- //tiene una dimension "100"
- //la primera posición es la 0 y la utima DIM-1 (0-4)
- //la cantidad de elementos es FIJA
- int notas[5] = {0} ;
- char wordle[5];
- float precios[10];
- /*
- for (int i = 0; i<5; i++)
- {
- notas[i] = i;
- }
- */
- //notas[0] = 1; //a la posición 0 (la primera) un numero (1)
- // int valor = 10;
- // notas[1] = valor; //a la posición 1 (la segunda) un numero (10)
- for (int i = 0; i<5; i++)
- {
- printf("ingrese el valor en la pos %d \n",(i+1));
- fflush(stdin);
- scanf("%d",¬as[i]);
- }
- for (int i = 0; i<5; i++)
- {
- printf("el valor en la pos %d es %d\n",(i+1),notas[i]);
- }
- float promedio = 0;
- int acumulador = 0;
- for (int i = 0; i<5;i++)
- {
- acumulador = acumulador + notas[i];
- }
- promedio = (float) (acumulador / 5);
- printf("el promedio es %f\n",promedio);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement