Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Pract 3
Pract 3
PRÁCTICA # 3
1° ENCONTRAR LA SIGUIENTE HORA. Resuelto por Mamani Pajarito Jhonathan Kevin el 24 de febrero del
2018 en la UMSA
DIAGRAMA DE FLUJO
UNIVERSIDAD MAYOR DE SAN ANDRES FECHA: 24/02/2018
CODIGO JAVA
//Horas - Minutos - Segundos
import java.util.Scanner;
public class ejer1
{
public static void main(String[] args)
{
int h, m, s;
Scanner sc=new Scanner (System.in);
System.out.println ("Introduzca Horas, minutos, segundos: \n\t(Formato de 24 hrs)");
h = sc.nextInt ();
if(h>23){
System.out.println ("Formato de hora incorrecto");
}
m = sc.nextInt();
if(m>59){
System.out.println ("Formato de hora incorrecto");
}
s = sc.nextInt ();
if(s>59){
System.out.println ("Formato de hora incorrecto");
}
else{
if(s==59){
s=0; m=m+1;
if(m==60){
m=0; h=h+1;
if(h==24){
h=0; s=s+1;
}
else{
}
}
else{
}
}
else{
s=s+1;
}
System.out.println ("La hora es: "+h+":"+m+":"+s);
}
}
}
CAPTURA DE PANTALLA
Encontrar la siguiente hora. Resuelto por Mamani Pajarito Jhonathan Kevin el 24 de febrero del 2018 en la
UMSA
UNIVERSIDAD MAYOR DE SAN ANDRES FECHA: 24/02/2018
2° ENCONTRAR EL SIGUIENTE DÍA. Resuelto por Mamani Pajarito Jhonathan Kevin el 24 de febrero del 2018
en la UMSA
Entrada Salida
DIAGRAMA DE FLUJO
CODIGO JAVA
//Encontrar_siguiente_dia
import java.util.Scanner;
public class ejer2
{
public static void main(String[] args)
{
int d, m, a;
Scanner sc=new Scanner (System.in);
System.out.println (" Introduzca el Día, mes y año:");
d = sc.nextInt ();
m = sc.nextInt ();
a = sc.nextInt ();
UNIVERSIDAD MAYOR DE SAN ANDRES FECHA: 24/02/2018
}
else{
d=d+1;
}
}
}
}
}
System.out.println ("La fecha es: "+d+"/"+m+"/"+a);
}
}
}
CAPTURA DE PANTALLA
ENCONTRAR EL SIGUIENTE DÍA. Resuelto por Mamani Pajarito Jhonathan Kevin el 24 de febrero del 2018 en
la UMSA.
UNIVERSIDAD MAYOR DE SAN ANDRES FECHA: 24/02/2018
3° ¿CUANTOS LADRILLOS ENTRAN EN UNA PARED DE BASE (B) Y ALTURA (H)? Resuelto por Mamani
Pajarito Jhonathan Kevin el 24 de febrero del 2018 en la UMSA.
DIAGRAMA DE FLUJO
CODIGO JAVA
//Cuantos_ladrillos_entran_en_una_pared
import java.util.Scanner;
public class ejer3
{
public static void main(String[] args)
{
int al, b, h, a;
al = 450;
Scanner sc=new Scanner (System.in);
System.out.println ("Introduzca la base y altura de la pared:");
b = sc.nextInt ();
h = sc.nextInt ();
b = b * 100;
h = h * 100;
a = b * h;
a = a / al;
System.out.println ("Entran "+a+" ladrillos");
}
}
CAPTURA DE PANTALLA
¿CUANTOS LADRILLOS ENTRAN EN UNA PARED DE BASE (B) Y ALTURA (H)? Resuelto por Mamani
Pajarito Jhonathan Kevin el 24 de febrero del 2018 en la UMSA.