Vous êtes sur la page 1sur 1

COMPUTACIN U.N.T. Mg.

Gmez Avila, Jos


REPASO DE VECTORES
1. Que rellene un array con los 100 primeros nmeros enteros y los muestre en pantalla
en orden ascendente.
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
int x,tabla[100];
for (x=1;x<=100;x++)
{ tabla[x]=x; }
for (x=1;x<=100;x++)
{ printf("%d\n",tabla[x]); }
system("PAUSE");
return 0;
}
2. Que rellene un array con los nmeros pares comprendidos entre 1 y 100 y los muestre
en pantalla en orden ascendente.
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
int x,cont,z,i,tabla[100];
i=0;
for (x=1;x<=100;x++)
{ cont=0;
if (x%2==0)
{ tabla[i]=x; i++; }
}
for (x=0;x<i;x++)
{ printf("%d\n",tabla[x]); }
system("PAUSE");
return 0;
}
EJERCICIOS PROPUESTOS
a) Que lea 10 nmeros por teclado, los almacene en un array y muestre la suma, resta,
multiplicacin y divisin de todos
b) Que lea 5 nmeros por teclado, los copie a otro array multiplicados por 2 y
muestre el segundo array.
c) Que mediante un array almacene nmeros tanto positivos como negativos y los
muestre ordenados.

Vous aimerez peut-être aussi