13.07.2015 Views

LÓGICA DE PROGRAMACIÓN Grupo SOCRATES - Aves.edu.co

LÓGICA DE PROGRAMACIÓN Grupo SOCRATES - Aves.edu.co

LÓGICA DE PROGRAMACIÓN Grupo SOCRATES - Aves.edu.co

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

1.5.2 Auto evaluación1.6 Ciclo 'Para' o 'Desde' (FOR DO)Esta sentencia repetitiva, es un bucle <strong>co</strong>ntrolado por un <strong>co</strong>ntador, denominadovariable de <strong>co</strong>ntrol o índice, cuenta <strong>co</strong>n un valor inicial y uno final que determinanel numero de veces que se repetirá una o varias instrucciones.Estructura:Lenguaje Algorítmi<strong>co</strong>‣ Para variable := V. inicial Hasta V. final HagaIparaInstrucciones…;n…Instrucciones;Fpara;1.6.1 EjemploEstructuras repetitivas Para o desde (For - Do): Se pide un programa donde se leeel nombre de un alumno y se ingresan sus 5 notas finales del semestre. Se pidecalcular e imprimir el promedio de sus notas. El código del programa, sería:Programa Notas;ConstantesN=5;VariablesI:entero;Nota,Suma,Promedio:Real;Nombre:cadena;InicioSuma:=0;Promedio:=0;escriba('Digite el nombre del alumno');lea(Nombre);Para I:= 1 hasta N HagaInicioescriba('Introduzca la nota No.',I);lea(Nota);Suma:=Suma+Nota;fin;

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!