Documente Academic
Documente Profesional
Documente Cultură
int main (){ int sum1 = 1; int sum2 = 1; int con = 0; int res;
Res = Sum1+Sum2
true
Imprimir Res
false
Sum2 = Sum1 Sum1 = Res
while (con<1000){ res = sum1 + sum2; printf ("%d, ", res); sum2 = sum1; sum1 = res; con++; } system("Pause"); return 0; } // Fin main
Fin
Con ++
33
M. en C. Miriam Balbuena
26/04/2012
Ejercicio
Disear el algoritmo y crear el programa para obtener la siguiente serie:
2, 3, 4, 6, 6, 9, 8, 12, 10, 15, 12, 18, 14, 21, 16
Mostrar los primeros 100 nmeros de la serie. Tiempo para la realizacin: 15 minutos.
34
M. en C. Miriam Balbuena
26/04/2012
Arreglos
35
M. en C. Miriam Balbuena
26/04/2012
Qu es un arreglo?
Variable que hace referencia a varias posiciones de memoria. Cada posicin se identifica con un ndice. El ndice comienza en 0.
miArreglo
36
M. en C. Miriam Balbuena
26/04/2012
Qu es un arreglo?
Variable que hace referencia a varias posiciones de memoria. Cada posicin se identifica con un ndice. El ndice comienza en 0.
37
M. en C. Miriam Balbuena
26/04/2012
Qu es un arreglo?
Declaracin:
int main (){
38
M. en C. Miriam Balbuena
26/04/2012
Qu es un arreglo?
Declaracin:
int main (){ int miArreglo[8]; system("Pause"); return 0; } // Fin main
miArreglo[0] Corchetes para indicar que es arreglo. miArreglo miArreglo[1] miArreglo[2] miArreglo[3] miArreglo[4] miArreglo[5] miArreglo[6] miArreglo[7]
39
M. en C. Miriam Balbuena
26/04/2012
Qu es un arreglo?
Declaracin:
int main (){
40
M. en C. Miriam Balbuena
26/04/2012
Qu es un arreglo?
Asignacin de memoria:
Asignacin de 8 posiciones de memoria para valores de tipo entero. miArreglo
system("Pause"); return 0; } // Fin main
int miArreglo[8];
41
M. en C. Miriam Balbuena
26/04/2012
Qu es un arreglo?
Asignacin de memoria:
int main (){ int miArreglo[8]; miArreglo[0] = 5
42
M. en C. Miriam Balbuena
26/04/2012
Qu es un arreglo?
Asignacin de memoria:
int main (){ int miArreglo[8]; miArreglo[0] = 5;
5 10
43
M. en C. Miriam Balbuena
26/04/2012
Qu es un arreglo?
Asignacin de memoria:
int main (){ int miArreglo[8]; miArreglo[0] = 5;
5 10 15
44
M. en C. Miriam Balbuena
26/04/2012
Ejercicio
Crear un programa que declare un arreglo llamado "vector" de 10 posiciones. Asignar el valor de 10 a cada posicin del arreglo. Mostrar todas las posiciones del arreglo.
vector[0] vector[1] vector[2] vector[3] vector[4] vector[5] vector[6] vector[7] vector[8] vector[9]
10 10 10 10 10 10 10 10 10 10
45
M. en C. Miriam Balbuena
26/04/2012
Cdigo repetitivo.
int main (){ int vector [10]; vector[0] vector[1] vector[2] vector[3] vector[4] vector[5] vector[6] vector[7] vector[8] vector[9] printf printf printf printf = = = = = = = = = = 10; 10; 10; 10; 10; 10; 10; 10; 10; 10; vector[0]); vector[1]); vector[2]); vector[3]);
Cdigo repetitivo.
int vector [10];
47
M. en C. Miriam Balbuena
26/04/2012
Cmo funciona?
int main (){
vector[0]
int vector [10]; int i = 0; while (i<10){ vector[i] = 10; i++; } i = 0; while (i<10){ printf ("%d", vector[i]); i++; } system("Pause"); return 0; } // Fin main
48 M. en C. Miriam Balbuena 26/04/2012
Cmo funciona?
int main (){
vector[0]
int vector [10]; int i = 0; while (i<10){ vector[i] = 10; i++; } i = 0; while (i<10){ printf ("%d", vector[i]); i++; } system("Pause"); return 0; } // Fin main
49
M. en C. Miriam Balbuena
26/04/2012
Cmo funciona?
int main (){
vector[0]
int vector [10]; int i = 0; while (i<10){ vector[i] = 10; i++; }
vector[1] vector[2] true vector[3] vector[4] vector[5] vector[6] vector[7] vector[8] vector[9] i 0
i = 0; while (i<10){ printf ("%d", vector[i]); i++; } system("Pause"); return 0; } // Fin main
50
M. en C. Miriam Balbuena
26/04/2012
Cmo funciona?
int main (){
vector[0]
int vector [10]; int i = 0; while (i<10){ vector[i] = 10; i++; } i = 0; while (i<10){ printf ("%d", vector[i]); i++; } system("Pause"); return 0; } // Fin main
51
10
M. en C. Miriam Balbuena
26/04/2012
Cmo funciona?
int main (){
vector[0]
int vector [10]; int i = 0; while (i<10){ vector[i] = 10; i++; } i = 0; while (i<10){ printf ("%d", vector[i]); i++; } system("Pause"); return 0; } // Fin main
52
10
M. en C. Miriam Balbuena
26/04/2012
Cmo funciona?
int main (){
vector[0]
int vector [10]; int i = 0; while (i<10){ vector[i] = 10; i++; } i = 0; while (i<10){ printf ("%d", vector[i]); i++; } system("Pause"); return 0; } // Fin main
53
10
M. en C. Miriam Balbuena
26/04/2012
Cmo funciona?
int main (){
vector[0]
int vector [10]; int i = 0; while (i<10){ vector[i] = 10; i++; }
10
vector[1] vector[2] true vector[3] vector[4] vector[5] vector[6] vector[7] vector[8] vector[9] i 1
i = 0; while (i<10){ printf ("%d", vector[i]); i++; } system("Pause"); return 0; } // Fin main
54
M. en C. Miriam Balbuena
26/04/2012
Cmo funciona?
int main (){
vector[0]
int vector [10]; int i = 0; while (i<10){ vector[i] = 10; i++; } i = 0; while (i<10){ printf ("%d", vector[i]); i++; } system("Pause"); return 0; } // Fin main
55
10 10
M. en C. Miriam Balbuena
26/04/2012
Cmo funciona?
int main (){
vector[0]
int vector [10]; int i = 0; while (i<10){ vector[i] = 10; i++; } i = 0; while (i<10){ printf ("%d", vector[i]); i++; } system("Pause"); return 0; } // Fin main
56
10 10
M. en C. Miriam Balbuena
26/04/2012
Cmo funciona?
int main (){
vector[0]
int vector [10]; int i = 0; while (i<10){ vector[i] = 10; i++; } i = 0; while (i<10){ printf ("%d", vector[i]); i++; } system("Pause"); return 0; } // Fin main
57
10 10
M. en C. Miriam Balbuena
26/04/2012
Cmo funciona?
int main (){
vector[0]
int vector [10]; int i = 0; while (i<10){ vector[i] = 10; i++; }
10 10
vector[1] vector[2] true vector[3] vector[4] vector[5] vector[6] vector[7] vector[8] vector[9] i
i = 0; while (i<10){ printf ("%d", vector[i]); i++; } system("Pause"); return 0; } // Fin main
58
M. en C. Miriam Balbuena
26/04/2012
Cmo funciona?
int main (){
vector[0]
int vector [10]; int i = 0; while (i<10){ vector[i] = 10; i++; } i = 0; while (i<10){ printf ("%d", vector[i]); i++; } system("Pause"); return 0; } // Fin main
59
10 10 10
M. en C. Miriam Balbuena
26/04/2012
Cmo funciona?
int main (){
vector[0]
int vector [10]; int i = 0; while (i<10){ vector[i] = 10; i++; } i = 0; while (i<10){ printf ("%d", vector[i]); i++; } system("Pause"); return 0; } // Fin main
60
10 10 10
M. en C. Miriam Balbuena
26/04/2012
Cmo funciona?
int main (){
vector[0]
int vector [10]; int i = 0; while (i<10){ vector[i] = 10; i++; }
10 10 10 10 10 10 10 10 10 10 10
vector[1] vector[2] false vector[3] vector[4] vector[5] vector[6] vector[7] vector[8] vector[9] i
i = 0; while (i<10){ printf ("%d", vector[i]); i++; } system("Pause"); return 0; } // Fin main
61
M. en C. Miriam Balbuena
26/04/2012
Ejercicio
Crear un arreglo de 100 posiciones. Llenar el arreglo con la tabla del 2. Mostrar el arreglo en pantalla. Tiempo: 5 min.
62
vector[0] vector[1] vector[2] vector[3] vector[4] vector[5] vector[6] vector[7] vector[8] vector[9]
0 2 4 6 8 10 12 14 16 18
M. en C. Miriam Balbuena
26/04/2012
Ciclo for
63
M. en C. Miriam Balbuena
26/04/2012
For
Funciona similar al while. Es muy til para recorrer arreglos. Sintaxis:
for (inicializacin ; condicin ; incremento){ // Bloque de cdigo que se repite. }
64
M. en C. Miriam Balbuena
26/04/2012
Ciclo while
int main (){ int vector [10]; int i = 0; while (i<10){ vector[i] = 10; i++; } }
i=0
true
i<10 Vector[i] = 10 i++
false Fin
65 M. en C. Miriam Balbuena 26/04/2012
Ciclo for
int main (){ int vector [10]; int i = 0; for (i=0; i<10, i++){ vector[i] = 10; }
i=0
true
i<10 Vector[i] = 10 i++
false Fin
66 M. en C. Miriam Balbuena 26/04/2012
Ciclo for
int main (){ int vector [10]; int i = 0; for ( i=0; i<10, i++){ vector[i] = 10; }
i=0
true
i<10 Vector[i] = 10 i++
false Fin
67 M. en C. Miriam Balbuena 26/04/2012
Ciclo for
int main (){ int vector [10]; int i = 0; for ( i=0; i<10, vector[i] = 10; }
i++){
i=0
true
i<10 Vector[i] = 10 i++
false Fin
68 M. en C. Miriam Balbuena 26/04/2012
Ciclo for
int main (){ int vector [10]; int i = 0; for ( i=0; i<10, i++){ vector[i] = 10; }
i=0
true
i<10 Vector[i] = 10 i++
false Fin
69 M. en C. Miriam Balbuena 26/04/2012
Ciclo for
int main (){ int vector [10]; int i = 0; for (i=0; i<10, i++){ vector[i] = 10; }
i=0
true
i<10 Vector[i] = 10 i++
false Fin
70 M. en C. Miriam Balbuena 26/04/2012
true
i<long/2 Imprime 2*i Imprime 3*i i++
false Fin
71
M. en C. Miriam Balbuena
26/04/2012
longitudSerie
50
true
i<long /2 Imprime 2*i Imprime 3*i i++
false Fin
72
M. en C. Miriam Balbuena
26/04/2012
longitudSerie
int longitudSerie = 50; int i; for ( i = 1; i<=(longitudSerie/2); i++){ printf("%d, ", 2*i); printf("%d, ", 3*i); }
i=0
50 1
true
i<long /2 Imprime 2*i Imprime 3*i i++
false Fin
73
M. en C. Miriam Balbuena
26/04/2012
longitudSerie
int longitudSerie = 50; int i; for ( i = 1; i<=(longitudSerie/2); i++){ printf("%d, ", 2*i); printf("%d, ", 3*i); }
i=0
50 1
true
true
i<long /2 Imprime 2*i Imprime 3*i i++
false Fin
74
M. en C. Miriam Balbuena
26/04/2012
longitudSerie
int longitudSerie = 50; int i; for ( i = 1; i<=(longitudSerie/2); i++){ printf("%d, ", 2*i); printf("%d, ", 3*i); }
i=0
50 1
true
i<long /2 Imprime 2*i Imprime 3*i i++
2, 3,
false Fin
75
M. en C. Miriam Balbuena
26/04/2012
longitudSerie
int longitudSerie = 50; int i; for ( i = 1; i<=(longitudSerie/2); i++){ printf("%d, ", 2*i); printf("%d, ", 3*i); }
i=0
50 2
true
i<long /2 Imprime 2*i Imprime 3*i i++
2, 3,
false Fin
76
M. en C. Miriam Balbuena
26/04/2012
longitudSerie
int longitudSerie = 50; int i; for ( i = 1; i<=(longitudSerie/2); i++){ printf("%d, ", 2*i); printf("%d, ", 3*i); }
i=0
50 2
true
true
i<long /2 Imprime 2*i Imprime 3*i i++
2, 3,
false Fin
77
M. en C. Miriam Balbuena
26/04/2012
longitudSerie
int longitudSerie = 50; int i; for ( i = 1; i<=(longitudSerie/2); i++){ printf("%d, ", 2*i); printf("%d, ", 3*i); }
i=0
50 2
true
i<long /2 Imprime 2*i Imprime 3*i i++
2, 3, 4, 6,
false Fin
78
M. en C. Miriam Balbuena
26/04/2012
longitudSerie
int longitudSerie = 50; int i; for ( i = 1; i<=(longitudSerie/2); i++){ printf("%d, ", 2*i); printf("%d, ", 3*i); }
i=0
50 3
true
i<long /2 Imprime 2*i Imprime 3*i i++
2, 3, 4, 6,
false Fin
79
M. en C. Miriam Balbuena
26/04/2012
longitudSerie
int longitudSerie = 50; int i; for ( i = 1; i<=(longitudSerie/2); i++){ printf("%d, ", 2*i); printf("%d, ", 3*i); }
i=0
50 3
true
true
i<long /2 Imprime 2*i Imprime 3*i i++
2, 3, 4, 6,
false Fin
80
M. en C. Miriam Balbuena
26/04/2012
longitudSerie
int longitudSerie = 50; int i; for ( i = 1; i<=(longitudSerie/2); i++){ printf("%d, ", 2*i); printf("%d, ", 3*i); }
i=0
50 3
true
i<long /2 Imprime 2*i Imprime 3*i i++
2, 3, 4, 6, 6, 9
false Fin
81
M. en C. Miriam Balbuena
26/04/2012
longitudSerie
int longitudSerie = 50; int i; for ( i = 1; i<=(longitudSerie/2); i++){ printf("%d, ", 2*i); printf("%d, ", 3*i); }
i=0
50 4
true
i<long /2 Imprime 2*i Imprime 3*i i++
2, 3, 4, 6, 6, 9,
false Fin
82
M. en C. Miriam Balbuena
26/04/2012
longitudSerie
int longitudSerie = 50; int i; for ( i = 1; i<=(longitudSerie/2); i++){ printf("%d, ", 2*i); printf("%d, ", 3*i); }
i=0
50 26
false 2, 3, 4, 6, 6, 9, 8, 12, 10, 15, 12, 18, 14, 21, 16, 24, 18, 27, 20, 30, 22, 33, 24, 36, 26, 39, 28, 42, 30, 45, 32, 48, 34, 51, 36, 54, 38, 57, 40, 60, 42, 63, 44, 66, 46, 69, 48, 72, 50, 75, BUILD SUCCESSFUL (total time: 1 second)
M. en C. Miriam Balbuena 26/04/2012
true
i<long /2 Imprime 2*i Imprime 3*i i++
false Fin
83
longitudSerie
int longitudSerie = 50; int i; for ( i = 1; i<=(longitudSerie/2); i++){ printf("%d, ", 2*i); printf("%d, ", 3*i); }
i=0
50 25
true
i<long /2 Imprime 2*i Imprime 3*i i++
false Fin
2, 3, 4, 6, 6, 9, 8, 12, 10, 15, 12, 18, 14, 21, 16, 24, 18, 27, 20, 30, 22, 33, 24, 36, 26, 39, 28, 42, 30, 45, 32, 48, 34, 51, 36, 54, 38, 57, 40, 60, 42, 63, 44, 66, 46, 69, 48, 72, 50, 75, Presione una tecla para continuar
M. en C. Miriam Balbuena 26/04/2012
84
Ejercicio
Declarar un arreglo llamado "a" de 100 posiciones. Utilizar un ciclo for para llenar el arreglo con valores del 100 al 1. Mostrar el arreglo en pantalla. Tiempo: 5 min.
85
a[0] a[1] a[2] a[3] a[4] a[5] a[6] a[7] a[8] a[9]
100 99 98 97 96 95 94 93 92 91
M. en C. Miriam Balbuena
26/04/2012
int main (){ int vector [10]; int i; for (i = 0; i<10; i++){ vector[i] = 10; } }
86
M. en C. Miriam Balbuena
26/04/2012
87
M. en C. Miriam Balbuena
26/04/2012
#include <stdio.h> int main(){ int miVariable; scanf ("%d", &miVariable); return 0; }
88 M. en C. Miriam Balbuena 26/04/2012
Ejemplo
int main () { numero int numero; printf ("Dame un nmero\n"); scanf ("%d", &numero); printf ("El nmero es: %d",numero); return 0; }
89
M. en C. Miriam Balbuena
26/04/2012
Ejemplo
int main () { numero int numero; printf ("Dame un nmero\n"); scanf ("%d", &numero); printf ("El nmero es: %d",numero); return 0; }
Dame un nmero \n
90
M. en C. Miriam Balbuena
26/04/2012
Ejemplo
int main () { numero int numero; printf ("Dame un nmero\n"); scanf ("%d", &numero); printf ("El nmero es: %d",numero); return 0; } 10
numero
91
Dame un nmero\n 10
26/04/2012
M. en C. Miriam Balbuena
Ejemplo
int main () { numero int numero; printf ("Dame un nmero\n"); scanf ("%d", &numero); printf ("El nmero es: %d",numero); return 0; } 10
Ejercicio
Solicitar dos nmeros del usuario. Guardar los nmeros en dos variables llamadas "a" y "b" Decidir cual de los dos nmeros es mayor e informrselo al usuario. Ejemplo:
Dame un nmero 9 Dame otro nmero 8 El nmero mayor es 9 Presione cualquier tecla para continuar
M. en C. Miriam Balbuena 26/04/2012
93
94
M. en C. Miriam Balbuena
26/04/2012
int main (){ int tamano, i, max; printf ("De qu tamao quieres el arreglo? \n"); scanf ("%d", &tamano); int numeros [tamano]; for (i=0; i<tamano ; i++){ printf("\n Ingresa numeros[%d]: ", i); scanf ("%d", &numeros[i]); } max = numeros[0]; for (i=0; i<tamano ; i++){ if (max < numeros[i]) max = numeros[i]; } printf ("El mayor es: %d",max); } // Fin main
95 M. en C. Miriam Balbuena 26/04/2012
tamano i max
tamano i max
tamano i max
tamano i max numeros [0] numeros [1] numeros [2] numeros [3] numeros [4]
tamano i max numeros [0] numeros [1] numeros [2] numeros [3] numeros [4]
5 0
tamano i max numeros [0] numeros [1] numeros [2] numeros [3] numeros [4]
5 0
tamano i max numeros [0] numeros [1] numeros [2] numeros [3] numeros [4]
5 0 4
tamano i max numeros [0] numeros [1] numeros [2] numeros [3] numeros [4]
5 0 4
tamano i max numeros [0] numeros [1] numeros [2] numeros [3] numeros [4]
5 1 4
tamano i max numeros [0] numeros [1] numeros [2] numeros [3] numeros [4]
5 1 4
M. en C. Miriam Balbuena
tamano i max numeros [0] numeros [1] numeros [2] numeros [3] numeros [4]
5 1 4 8
M. en C. Miriam Balbuena
tamano i max numeros [0] numeros [1] numeros [2] numeros [3] numeros [4]
5 1 4 8
M. en C. Miriam Balbuena
tamano i max numeros [0] numeros [1] numeros [2] numeros [3] numeros [4]
5 2 4 8
M. en C. Miriam Balbuena
tamano i max numeros [0] numeros [1] numeros [2] numeros [3] numeros [4]
5 2 4 8
M. en C. Miriam Balbuena
26/04/2012
tamano i max numeros [0] numeros [1] numeros [2] numeros [3] numeros [4]
5 2 4 8 9
M. en C. Miriam Balbuena
26/04/2012
tamano i max numeros [0] numeros [1] numeros [2] numeros [3] numeros [4]
5 2 4 8 9
M. en C. Miriam Balbuena
26/04/2012
tamano i max numeros [0] numeros [1] numeros [2] numeros [3] numeros [4]
5 3 4 8 9
M. en C. Miriam Balbuena
26/04/2012
tamano i max numeros [0] numeros [1] numeros [2] numeros [3] numeros [4]
5 3 4 8 9
M. en C. Miriam Balbuena
26/04/2012
tamano i max numeros [0] numeros [1] numeros [2] numeros [3] numeros [4]
5 3 4 8 9 3
M. en C. Miriam Balbuena
26/04/2012
tamano i max numeros [0] numeros [1] numeros [2] numeros [3] numeros [4]
5 3 4 8 9 3
M. en C. Miriam Balbuena
26/04/2012
tamano i max numeros [0] numeros [1] numeros [2] numeros [3] numeros [4]
5 4 4 8 9 3
M. en C. Miriam Balbuena
26/04/2012
}
117
Ingresa numeros[0]: 4 Ingresa numeros[1]: 8 printf ("El mayor es: %d",max); Ingresa numeros[2]: 9 Ingresa numeros[3]: 3 M. en C. Miriam Balbuena 26/04/2012 Ingresa numeros[4]:
}
118
Ingresa numeros[0]: 4 Ingresa numeros[1]: 8 printf ("El mayor es: %d",max); Ingresa numeros[2]: 9 Ingresa numeros[3]: 3 M. en C. Miriam Balbuena 26/04/2012 Ingresa numeros[4]: 1
}
119
Ingresa numeros[0]: 4 Ingresa numeros[1]: 8 printf ("El mayor es: %d",max); Ingresa numeros[2]: 9 Ingresa numeros[3]: 3 M. en C. Miriam Balbuena 26/04/2012 Ingresa numeros[4]: 1
}
120
Ingresa numeros[0]: 4 Ingresa numeros[1]: 8 printf ("El mayor es: %d",max); Ingresa numeros[2]: 9 Ingresa numeros[3]: 3 M. en C. Miriam Balbuena 26/04/2012 Ingresa numeros[4]: 1
}
121
Ingresa numeros[0]: 4 Ingresa numeros[1]: 8 printf ("El mayor es: %d",max); Ingresa numeros[2]: 9 Ingresa numeros[3]: 3 M. en C. Miriam Balbuena 26/04/2012 Ingresa numeros[4]: 1
}
122
Ingresa numeros[0]: 4 Ingresa numeros[1]: 8 printf ("El mayor es: %d",max); Ingresa numeros[2]: 9 Ingresa numeros[3]: 3 M. en C. Miriam Balbuena 26/04/2012 Ingresa numeros[4]: 1
}
123
Ingresa numeros[0]: 4 Ingresa numeros[1]: 8 printf ("El mayor es: %d",max); Ingresa numeros[2]: 9 Ingresa numeros[3]: 3 M. en C. Miriam Balbuena 26/04/2012 Ingresa numeros[4]: 1
}
124
Ingresa numeros[0]: 4 Ingresa numeros[1]: 8 printf ("El mayor es: %d",max); Ingresa numeros[2]: 9 Ingresa numeros[3]: 3 M. en C. Miriam Balbuena 26/04/2012 Ingresa numeros[4]: 1
}
125
Ingresa numeros[0]: 4 Ingresa numeros[1]: 8 printf ("El mayor es: %d",max); Ingresa numeros[2]: 9 Ingresa numeros[3]: 3 M. en C. Miriam Balbuena 26/04/2012 Ingresa numeros[4]: 1
}
126
Ingresa numeros[0]: 4 Ingresa numeros[1]: 8 printf ("El mayor es: %d",max); Ingresa numeros[2]: 9 Ingresa numeros[3]: 3 M. en C. Miriam Balbuena 26/04/2012 Ingresa numeros[4]: 1
}
127
Ingresa numeros[0]: 4 Ingresa numeros[1]: 8 printf ("El mayor es: %d",max); Ingresa numeros[2]: 9 Ingresa numeros[3]: 3 M. en C. Miriam Balbuena 26/04/2012 Ingresa numeros[4]: 1
}
128
Ingresa numeros[0]: 4 Ingresa numeros[1]: 8 printf ("El mayor es: %d",max); Ingresa numeros[2]: 9 Ingresa numeros[3]: 3 M. en C. Miriam Balbuena 26/04/2012 Ingresa numeros[4]: 1
}
129
Ingresa numeros[0]: 4 Ingresa numeros[1]: 8 printf ("El mayor es: %d",max); Ingresa numeros[2]: 9 Ingresa numeros[3]: 3 M. en C. Miriam Balbuena 26/04/2012 Ingresa numeros[4]: 1
}
130
Ingresa numeros[0]: 4 Ingresa numeros[1]: 8 printf ("El mayor es: %d",max); Ingresa numeros[2]: 9 Ingresa numeros[3]: 3 M. en C. Miriam Balbuena 26/04/2012 Ingresa numeros[4]: 1
}
131
Ingresa numeros[0]: 4 Ingresa numeros[1]: 8 printf ("El mayor es: %d",max); Ingresa numeros[2]: 9 Ingresa numeros[3]: 3 M. en C. Miriam Balbuena 26/04/2012 Ingresa numeros[4]: 1
}
132
Ingresa numeros[0]: 4 Ingresa numeros[1]: 8 printf ("El mayor es: %d",max); Ingresa numeros[2]: 9 Ingresa numeros[3]: 3 M. en C. Miriam Balbuena 26/04/2012 Ingresa numeros[4]: 1
}
133
Ingresa numeros[0]: 4 Ingresa numeros[1]: 8 printf ("El mayor es: %d",max); Ingresa numeros[2]: 9 Ingresa numeros[3]: 3 M. en C. Miriam Balbuena 26/04/2012 Ingresa numeros[4]: 1
}
134
Ingresa numeros[0]: 4 Ingresa numeros[1]: 8 printf ("El mayor es: %d",max); Ingresa numeros[2]: 9 Ingresa numeros[3]: 3 M. en C. Miriam Balbuena 26/04/2012 Ingresa numeros[4]: 1
}
135
Ingresa numeros[0]: 4 Ingresa numeros[1]: 8 printf ("El mayor es: %d",max); Ingresa numeros[2]: 9 Ingresa numeros[3]: 3 M. en C. Miriam Balbuena 26/04/2012 Ingresa numeros[4]: 1
}
136
Ingresa numeros[0]: 4 Ingresa numeros[1]: 8 printf ("El mayor es: %d",max); Ingresa numeros[2]: 9 Ingresa numeros[3]: 3 M. en C. Miriam Balbuena 26/04/2012 Ingresa numeros[4]: 1
}
137
Ingresa numeros[0]: 4 Ingresa numeros[1]: 8 printf ("El mayor es: %d",max); Ingresa numeros[2]: 9 Ingresa numeros[3]: 3 M. en C. Miriam Balbuena 26/04/2012 Ingresa numeros[4]: 1
}
138
Ingresa numeros[0]: 4 Ingresa numeros[1]: 8 printf ("El mayor es: %d",max); Ingresa numeros[2]: 9 Ingresa numeros[3]: 3 M. en C. Miriam Balbuena 26/04/2012 Ingresa numeros[4]: 1
}
139
Ingresa numeros[0]: 4 Ingresa numeros[1]: 8 printf ("El mayor es: %d",max); Ingresa numeros[2]: 9 Ingresa numeros[3]: 3 M. en C. Miriam Balbuena 26/04/2012 Ingresa numeros[4]: 1
}
140
Ingresa numeros[0]: 4 Ingresa numeros[1]: 8 printf ("El mayor es: %d",max); Ingresa numeros[2]: 9 Ingresa numeros[3]: 3 M. en C. Miriam Balbuena 26/04/2012 Ingresa numeros[4]: 1
tamano i max numeros [0] numeros [1] numeros [2] numeros [3] numeros [4]
5 5 9 4 8 9 3 1
Ingresa numeros[0]: 4 Ingresa numeros[1]: 8 Ingresa numeros[2]: 9 Ingresa numeros[3]: 3 Ingresa numeros[4]: 1 El mayor es: 9
M. en C. Miriam Balbuena 26/04/2012
}
142
Ingresa numeros[0]: 4 Ingresa numeros[1]: 8 Ingresa numeros[2]: 9 Ingresa numeros[3]: 3 printf ("El mayor es: %d",max); Ingresa numeros[4]: 1 El mayor es: 9 M. en PresioneBalbuena 26/04/2012 C. Miriam cualquier tecla para continuar
Ejercicios
1) Crear un programa que obtenga los valores de un arreglo de teclado. El programa debe determinar el ms pequeo de los elementos del arreglo y mostrarlo en pantalla. 2) Crear un programa que cree un arreglo de 5 posiciones. El programa debe pedir los 5 valores al usuario para llenar el arreglo. Posteriormente debe calcular el promedio de los 5 valores y mostrarlo en pantalla. 3) Crear un programa que reciba N valores y los almacene en un arreglo. El programa debe mostrar los valores del arreglo ordenados de menor a mayor.
143 M. en C. Miriam Balbuena 26/04/2012