1. UNIVERSIDAD TÉCNICA DE MACHALA
FACULTAD DE INGENIERÍA CIVIL
ESCUELA DE INFORMÁTICA
CARRERA DE INGENIERÍA EN SISTEMAS
PROGRAMACION ESTRUCTURADA
AUTOR:
EDWIN EBER BELDUMA MOROCHO
PERIODO 2013 - 2014
MACHALA – EL ORO – ECUADOR
2. OPERACIONESENJAVA Y ESTRUCTURA
WHILE REPETITIVA….
• package principal;
• import java.util.Scanner;
• public class FormulaDeRadicales {
• public static void main(String[] args) {
• Scanner sc = new Scanner(System.in);
• double n1;
• double n2;
• double n3;
• double r;
• System.out.println("Ingrese el primer numero:");
• n1 = sc.nextDouble();
• System.out.println("Ingrese el segundo numero:");
• n2 = sc.nextDouble();
• System.out.println("Ingrese el tercer numero:");
• n3 = sc.nextDouble();
• r = (Math.sqrt(Math.pow((n1 + n2 + n3), 5)) + (8 * n3) - (Math.sqrt(n1
• + n2)))
• / (Math.pow(
• Math.sqrt((Math.sqrt(n1 + n3) + Math.sqrt(n3) + Math
• .sqrt(n2 + n3))), 5));
• System.out.println("El resultado es: " + r);
• }
• }
4. • package principal;
• import java.util.Scanner;
• public class Formula3 {
• public static void main(String[] args) {
• Scanner scan = new Scanner(System.in);
• double n1;
• double n2;
• double n3;
• double r;
• System.out.println("ingrese el primer numero ");
• n1 = scan.nextDouble();
• System.out.println("ingrese el segundo numero");
• n2 = scan.nextDouble();
• System.out.println("ingrese el tercer numero");
• n3 = scan.nextDouble();
• r = (Math.pow(
• (Math.sqrt((Math.sqrt(n1 + n3)) + (Math.sqrt(n3))
• + (Math.sqrt(n2 + n3)))), 5));
• System.out.println("resultado" + r);
• }
• }
5. • /**
• * The main method.
• *
• * @param args the arguments
• */
• public static void main(String[] args) {
• Scanner scan = new Scanner(System.in);
• double spvp = 0;
• double sg = 0;
• float pvp;
• float ganan;
• int numero = 1;
• /**
• * hasta que numero sea menor igual a 4 hacer las instrucciones
• */
• while (numero <= 4) {
• System.out.println("ingrese el codigo");
• int cod = scan.nextInt();
• System.out.println("ingrese la descripcion del producto");
• Scanner teclado = new Scanner(System.in);
• String descrip;
• descrip = teclado.next();
• System.out.println("ingrese el modelo");
• String mod;
• mod = teclado.next();
• System.out.println("ingrese el precio de costo");
• float pc = scan.nextFloat();
• ganan = (float) (pc * 0.25);
• pvp = pc + ganan;
• System.out.println("el precio de venta al publico es " + pvp);
• sg = sg + ganan;
• spvp = spvp + pvp;
• numero = numero + 1;
• }
• System.out.println("la suma total de las ganancias es " + sg);
• System.out.println("la suma total del precio deventa al publico es "
• + spvp);
• }
• }