Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include "../pila.h"
- int main()
- {
- int idEmpleados [100] = {0};
- char mander = 's';
- int validos = 0;
- int valor = 0;
- int suma = 0;
- int limite = 5;
- while ((mander == 's') && (validos < limite))
- {
- printf("ingrese un numero\n");
- fflush(stdin);
- scanf("%d",&valor);
- idEmpleados[validos] = valor;
- validos++;
- printf("ingrese si desea seguir? s/n\n");
- fflush(stdin);
- scanf("%c",&mander);
- }
- for (int i=0;i<validos;i++)
- {
- printf("%d arreglo[%d] --> %d\n",i,i+1,idEmpleados[i]);
- }
- for (int i=0;i<validos;i++)
- {
- suma = suma + idEmpleados[i];
- }
- printf("la suma es %d",suma);
- idEmpleados[0] = 1; //ASIGNA
- int menor = idEmpleados[0];//COPIA
- for (int i=1;i<validos;i++)
- {
- if (menor > idEmpleados[i])
- {
- menor = idEmpleados[i];//COPIA
- }
- }
- printf("el menor es %d",suma);
- }
Advertisement
Add Comment
Please, Sign In to add comment