SlideShare una empresa de Scribd logo
1 de 7
Introducción a la
Programación con JAVA
             Lic. Carla Salazar Serrudo
      Carrera de Ingeniería Informática
                           UMSS - 2013




                                          1
                                          
Estructuras de Control

 Muchas  veces es necesario alterar el orden en que
  se ejecutan las instrucciones de un programa.
 El orden preestablecido es secuencial, pero se
  puede alterar.
 Las estructuras de control permiten cambiar el
  orden normal de ejecución de un programa
 Pueden ser:
    ◦ Estructuras de selección: Permiten elegir entre un grupo
      de instrucciones u otro
    ◦ Estructuras de repetición: Permiten repetir un grupo de
      instrucciones.


                                                                 2
                                                                 
Estructura selección:
condicional simple

                                  if (condición) {
           condición                 acción1;
                       True       }else {
   False
                                     acción2;
                                  }
 acción2                acción1




                                                     3
                                                     
Condicional simple

De  acuerdo al resultado de la evaluación
 de una condición se realiza una acción u
 otra
Sintaxis:
 ◦   if (condición) acción;
 ◦   if (condición) {acción1; acción 2;…;acciónN}
 ◦   if (condición) acción1 else acción2;
 ◦   if (condición) {acción1; …;acciónN}
     else{acción1; ..;acciónN}
                                                    4
                                                    
Ejemplo de condicional
…
if(calif >= 70)
  System.out.println(“Aprobado”);
else {
  System.out.println(“Reprobado”);
  System.out.println(“Cursar de nuevo
  materia”);
}
…
                                        5
                                        
Ejercicio
Encuentre  las raíces de una ecuación de
 segundo grado: ax2 + bx + c
Sabiendo que, de acuerdo al valor del
 discriminante
 ◦ D = Math.sqrt( b2 – 4ac)
 ◦ Se pueden tener 2 raíces, 1 raíz (o dos
   iguales) y 0 raíces



                                             6
                                             
Ejercicio
Encuentre  las raíces de una ecuación de
 segundo grado: ax2 + bx + c
Sabiendo que, de acuerdo al valor del
 discriminante
 ◦ D = Math.sqrt( b2 – 4ac)
 ◦ Se pueden tener 2 raíces, 1 raíz (o dos
   iguales) y 0 raíces



                                             6
                                             

Más contenido relacionado

Último

RESOLUCION_VICE_MINISTERIAL-00048-2024-M-EVALUACIÓN EVALAUCION FORMATIVA MINE...
RESOLUCION_VICE_MINISTERIAL-00048-2024-M-EVALUACIÓN EVALAUCION FORMATIVA MINE...RESOLUCION_VICE_MINISTERIAL-00048-2024-M-EVALUACIÓN EVALAUCION FORMATIVA MINE...
RESOLUCION_VICE_MINISTERIAL-00048-2024-M-EVALUACIÓN EVALAUCION FORMATIVA MINE...
helmer del pozo cruz
 
Profecia 2300 dias explicada, Daniel 8:14
Profecia 2300 dias explicada, Daniel 8:14Profecia 2300 dias explicada, Daniel 8:14
Profecia 2300 dias explicada, Daniel 8:14
KevinBuenrostro4
 
SISTEMA RESPIRATORIO DEL CUERPO HUMANO triptico.docx
SISTEMA RESPIRATORIO DEL CUERPO HUMANO triptico.docxSISTEMA RESPIRATORIO DEL CUERPO HUMANO triptico.docx
SISTEMA RESPIRATORIO DEL CUERPO HUMANO triptico.docx
gesicavillanuevaqf
 
Ediciones Previas Proyecto de Innovacion Pedagogica ORIGAMI 3D Ccesa007.pdf
Ediciones Previas Proyecto de Innovacion Pedagogica ORIGAMI 3D  Ccesa007.pdfEdiciones Previas Proyecto de Innovacion Pedagogica ORIGAMI 3D  Ccesa007.pdf
Ediciones Previas Proyecto de Innovacion Pedagogica ORIGAMI 3D Ccesa007.pdf
Demetrio Ccesa Rayme
 
Pasos para enviar una tarea en SIANET - sólo estudiantes.pdf
Pasos para enviar una tarea en SIANET - sólo estudiantes.pdfPasos para enviar una tarea en SIANET - sólo estudiantes.pdf
Pasos para enviar una tarea en SIANET - sólo estudiantes.pdf
NELLYKATTY
 
ANTOLOGIA COMPLETA ANITA LA ABEJITA PARA LA LECTOESCRITURA EN PRIMER GRADO.pdf
ANTOLOGIA COMPLETA ANITA LA ABEJITA PARA LA LECTOESCRITURA EN PRIMER GRADO.pdfANTOLOGIA COMPLETA ANITA LA ABEJITA PARA LA LECTOESCRITURA EN PRIMER GRADO.pdf
ANTOLOGIA COMPLETA ANITA LA ABEJITA PARA LA LECTOESCRITURA EN PRIMER GRADO.pdf
lvela1316
 

Último (20)

Sesión de clase Motivados por la esperanza.pdf
Sesión de clase Motivados por la esperanza.pdfSesión de clase Motivados por la esperanza.pdf
Sesión de clase Motivados por la esperanza.pdf
 
RESOLUCION_VICE_MINISTERIAL-00048-2024-M-EVALUACIÓN EVALAUCION FORMATIVA MINE...
RESOLUCION_VICE_MINISTERIAL-00048-2024-M-EVALUACIÓN EVALAUCION FORMATIVA MINE...RESOLUCION_VICE_MINISTERIAL-00048-2024-M-EVALUACIÓN EVALAUCION FORMATIVA MINE...
RESOLUCION_VICE_MINISTERIAL-00048-2024-M-EVALUACIÓN EVALAUCION FORMATIVA MINE...
 
TERCER GRADO PROGRAMACION ANUAL CCSS 3° - 2024.docx
TERCER GRADO PROGRAMACION ANUAL CCSS 3° - 2024.docxTERCER GRADO PROGRAMACION ANUAL CCSS 3° - 2024.docx
TERCER GRADO PROGRAMACION ANUAL CCSS 3° - 2024.docx
 
La historia de la vida estudiantil a 102 años de la fundación de las Normales...
La historia de la vida estudiantil a 102 años de la fundación de las Normales...La historia de la vida estudiantil a 102 años de la fundación de las Normales...
La historia de la vida estudiantil a 102 años de la fundación de las Normales...
 
TEMA EGIPTO.pdf. Presentación civilización
TEMA EGIPTO.pdf. Presentación civilizaciónTEMA EGIPTO.pdf. Presentación civilización
TEMA EGIPTO.pdf. Presentación civilización
 
A propósito de la globalización y la financiarización del mundo
A propósito de la globalización y la financiarización del mundoA propósito de la globalización y la financiarización del mundo
A propósito de la globalización y la financiarización del mundo
 
Hidrocarburos cíclicos, EJERCICIOS, TEORIA Y MÁS.pptx
Hidrocarburos cíclicos, EJERCICIOS, TEORIA Y MÁS.pptxHidrocarburos cíclicos, EJERCICIOS, TEORIA Y MÁS.pptx
Hidrocarburos cíclicos, EJERCICIOS, TEORIA Y MÁS.pptx
 
Comunidades Virtuales de Aprendizaje Caracteristicas.pptx
Comunidades Virtuales de Aprendizaje Caracteristicas.pptxComunidades Virtuales de Aprendizaje Caracteristicas.pptx
Comunidades Virtuales de Aprendizaje Caracteristicas.pptx
 
ACERTIJO SOPA DE LETRAS OLÍMPICA. Por JAVIER SOLIS NOYOLA
ACERTIJO SOPA DE LETRAS OLÍMPICA. Por JAVIER SOLIS NOYOLAACERTIJO SOPA DE LETRAS OLÍMPICA. Por JAVIER SOLIS NOYOLA
ACERTIJO SOPA DE LETRAS OLÍMPICA. Por JAVIER SOLIS NOYOLA
 
Profecia 2300 dias explicada, Daniel 8:14
Profecia 2300 dias explicada, Daniel 8:14Profecia 2300 dias explicada, Daniel 8:14
Profecia 2300 dias explicada, Daniel 8:14
 
Revista Faro Normalista 6, 18 de mayo 2024
Revista Faro Normalista 6, 18 de mayo 2024Revista Faro Normalista 6, 18 de mayo 2024
Revista Faro Normalista 6, 18 de mayo 2024
 
tema 6 2eso 2024. Ciencias Sociales. El final de la Edad Media en la Penínsul...
tema 6 2eso 2024. Ciencias Sociales. El final de la Edad Media en la Penínsul...tema 6 2eso 2024. Ciencias Sociales. El final de la Edad Media en la Penínsul...
tema 6 2eso 2024. Ciencias Sociales. El final de la Edad Media en la Penínsul...
 
SISTEMA RESPIRATORIO DEL CUERPO HUMANO triptico.docx
SISTEMA RESPIRATORIO DEL CUERPO HUMANO triptico.docxSISTEMA RESPIRATORIO DEL CUERPO HUMANO triptico.docx
SISTEMA RESPIRATORIO DEL CUERPO HUMANO triptico.docx
 
Ediciones Previas Proyecto de Innovacion Pedagogica ORIGAMI 3D Ccesa007.pdf
Ediciones Previas Proyecto de Innovacion Pedagogica ORIGAMI 3D  Ccesa007.pdfEdiciones Previas Proyecto de Innovacion Pedagogica ORIGAMI 3D  Ccesa007.pdf
Ediciones Previas Proyecto de Innovacion Pedagogica ORIGAMI 3D Ccesa007.pdf
 
RESPONSABILIDAD SOCIAL EN LAS ORGANIZACIONES (4).pdf
RESPONSABILIDAD SOCIAL EN LAS ORGANIZACIONES (4).pdfRESPONSABILIDAD SOCIAL EN LAS ORGANIZACIONES (4).pdf
RESPONSABILIDAD SOCIAL EN LAS ORGANIZACIONES (4).pdf
 
Pasos para enviar una tarea en SIANET - sólo estudiantes.pdf
Pasos para enviar una tarea en SIANET - sólo estudiantes.pdfPasos para enviar una tarea en SIANET - sólo estudiantes.pdf
Pasos para enviar una tarea en SIANET - sólo estudiantes.pdf
 
ANTOLOGIA COMPLETA ANITA LA ABEJITA PARA LA LECTOESCRITURA EN PRIMER GRADO.pdf
ANTOLOGIA COMPLETA ANITA LA ABEJITA PARA LA LECTOESCRITURA EN PRIMER GRADO.pdfANTOLOGIA COMPLETA ANITA LA ABEJITA PARA LA LECTOESCRITURA EN PRIMER GRADO.pdf
ANTOLOGIA COMPLETA ANITA LA ABEJITA PARA LA LECTOESCRITURA EN PRIMER GRADO.pdf
 
EVALUACION del tercer trimestre 2024 nap.docx
EVALUACION  del tercer trimestre 2024 nap.docxEVALUACION  del tercer trimestre 2024 nap.docx
EVALUACION del tercer trimestre 2024 nap.docx
 
Análisis de los factores internos en una Organización
Análisis de los factores internos en una OrganizaciónAnálisis de los factores internos en una Organización
Análisis de los factores internos en una Organización
 
¿Que es Fuerza? online 2024 Repaso CRECE.pptx
¿Que es Fuerza? online 2024 Repaso CRECE.pptx¿Que es Fuerza? online 2024 Repaso CRECE.pptx
¿Que es Fuerza? online 2024 Repaso CRECE.pptx
 

Destacado

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

Destacado (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

aprentic3 presentacion con slideshare con sonido y video

  • 1. Introducción a la Programación con JAVA Lic. Carla Salazar Serrudo Carrera de Ingeniería Informática UMSS - 2013 1 
  • 2. Estructuras de Control  Muchas veces es necesario alterar el orden en que se ejecutan las instrucciones de un programa.  El orden preestablecido es secuencial, pero se puede alterar.  Las estructuras de control permiten cambiar el orden normal de ejecución de un programa  Pueden ser: ◦ Estructuras de selección: Permiten elegir entre un grupo de instrucciones u otro ◦ Estructuras de repetición: Permiten repetir un grupo de instrucciones.  2 
  • 3. Estructura selección: condicional simple if (condición) { condición acción1; True }else { False acción2; } acción2 acción1 3 
  • 4. Condicional simple De acuerdo al resultado de la evaluación de una condición se realiza una acción u otra Sintaxis: ◦ if (condición) acción; ◦ if (condición) {acción1; acción 2;…;acciónN} ◦ if (condición) acción1 else acción2; ◦ if (condición) {acción1; …;acciónN} else{acción1; ..;acciónN} 4 
  • 5. Ejemplo de condicional … if(calif >= 70) System.out.println(“Aprobado”); else { System.out.println(“Reprobado”); System.out.println(“Cursar de nuevo materia”); } … 5 
  • 6. Ejercicio Encuentre las raíces de una ecuación de segundo grado: ax2 + bx + c Sabiendo que, de acuerdo al valor del discriminante ◦ D = Math.sqrt( b2 – 4ac) ◦ Se pueden tener 2 raíces, 1 raíz (o dos iguales) y 0 raíces 6 
  • 7. Ejercicio Encuentre las raíces de una ecuación de segundo grado: ax2 + bx + c Sabiendo que, de acuerdo al valor del discriminante ◦ D = Math.sqrt( b2 – 4ac) ◦ Se pueden tener 2 raíces, 1 raíz (o dos iguales) y 0 raíces 6 