Advertisement
gmmmarcos

practico 4 - arreglos - ejercicio 1 (con correcciones)

Apr 24th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include "pila.h"
  4.  
  5. int main()
  6. {
  7. int hola[8];
  8. int validos;
  9. validos=CargarArreglo (hola,8);
  10.  
  11. return 0;
  12. }
  13.  
  14. int CargarArreglo ( int a[], int dimension)
  15. {
  16. char respuesta = 's';
  17. int i = 0;
  18.  
  19. while ( i < dimension && respuesta != 'n')
  20. {
  21. printf (\n"Ingrese un numero\n");
  22. scanf ("%i",&a[i]);
  23. printf ("\n Desea continuar?\n");
  24. scanf ("%c",&respuesta);
  25. i++;
  26. }
  27. return i;
  28. }
  29.  
  30.  
  31.  
  32.  
  33. /* 1. Hacer una función que reciba como parámetro un arreglo de números enteros y
  34. permita que el usuario ingrese valores al mismo por teclado.
  35. La función debe retornar la cantidad deelementos cargados en el arreglo.*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement