Download - PROGRAMAS ESTRUCTURADOS LENGUAJE C
![Page 2: PROGRAMAS ESTRUCTURADOS LENGUAJE C](https://reader036.vdocumento.com/reader036/viewer/2022082623/547d396eb4af9fbe158b54b4/html5/thumbnails/2.jpg)
Desarrollo de Programas Estructurados
• Sentencias Repetitivas:– for …– while …– do.. while …
![Page 3: PROGRAMAS ESTRUCTURADOS LENGUAJE C](https://reader036.vdocumento.com/reader036/viewer/2022082623/547d396eb4af9fbe158b54b4/html5/thumbnails/3.jpg)
Conceptos Básicos
Repetición Indefinida
• No se conoce el número de veces que se realizará la repetición.
• Se utiliza un dato "Centinela", la cual indica el "final de la ejecución de la repetición". Por ejemplo: presione 0 para finalizar el programa.
![Page 4: PROGRAMAS ESTRUCTURADOS LENGUAJE C](https://reader036.vdocumento.com/reader036/viewer/2022082623/547d396eb4af9fbe158b54b4/html5/thumbnails/4.jpg)
while (condicion)
{
sentencias;
}
Sentencia Repetitiva: while
![Page 5: PROGRAMAS ESTRUCTURADOS LENGUAJE C](https://reader036.vdocumento.com/reader036/viewer/2022082623/547d396eb4af9fbe158b54b4/html5/thumbnails/5.jpg)
• La sentencia for:
• Es muy similar a:
for (i=1; i<=10; i++){
/*cuerpo*/}
Aquí debe inicializarse la variable índice.
Relación entre el for y el while
Inicialización de índice;while (condicion){
sentencias;incremento/decremento;
}
for (inicio; condicion; inc/dec){
sentencias;}
i = 1;while (i <= 10){
/*cuerpo*/i++;
}Aquí debe realizarse el incremento de i.
![Page 6: PROGRAMAS ESTRUCTURADOS LENGUAJE C](https://reader036.vdocumento.com/reader036/viewer/2022082623/547d396eb4af9fbe158b54b4/html5/thumbnails/6.jpg)
Tarea• Escriba un programa que muestre una tabla de
multiplicar del 1 al 10, con el siguiente formato.
1*1
1*2
1*3
1*4
..
1*10
5*1
5*2
5*3
5*4
..
5*10
1
2
3
4
5
6
7
8
9
10
1 2 3 4 5 6 7 8 9 10