Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package m;
- import java.util.Scanner;
- /**
- *
- * @author Bryan
- */
- public class M {
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- // TODO code application logic here
- double nota1, nota2, nota3, promedio;
- Scanner teclado = new Scanner(System.in);
- System.out.print("Ingrese la primera nota: ");
- nota1= teclado.nextDouble();
- System.out.print("Ingrese la segunda nota: ");
- nota2 = teclado.nextDouble();
- System.out.print("Ingrese la tercera nota: ");
- nota3 = teclado.nextDouble();
- promedio= (nota1+ nota2+ nota3)/3;
- System.out.println("Su promedio es: " +promedio);
- System.out.println("EJERCICIO #1");
- //------------------------------------------------------------
- int numero,plus , suma=0;
- System.out.print ("Ingrese Número: ");
- numero = teclado.nextInt();
- while (numero !=0) {
- plus = numero % 10;
- numero = numero / 10;
- suma = suma + plus;
- }
- System.out.println( "la suma de cifras es: "+ suma);
- System.out.println ("EJERCICIO #2 ");
- //--------------------------------------------------------------------
- float a,p,n,x;
- System.out.print("Valor depósito Mensual: ");
- p = teclado.nextInt();
- System.out.print("Cantidad de depósitos Mensuales: ");
- n = teclado.nextInt();
- System.out.print("Tasa de interes Mensual: ");
- x= teclado.nextFloat();
- a = (float) (Math.pow((double)(1+x),(double) (x-1)))/x;
- System.out.println ("El valor acumulado es: "+a);
- System.out.println("EJERCICIO #3 ");
- //----------------------------------------------------------
- double radio,h,areat,volumt;
- System.out.print("Ingrese el valor del radio: ");
- radio = teclado.nextDouble();
- System.out.print("Ingrese valor de la Altura: ");
- h = teclado.nextDouble();
- areat = ((2)*(3.146)*(radio))*(h+radio);
- volumt =(3.1416) * (radio*radio)*(h);
- System.out.println ("El área total de un cilindro es: " + areat+ "cm2" );
- System.out.println ("El volumen de un cilindro es: " +volumt+ "cm3");
- System.out.println("EJERCICIO#4");
- //-------------------------------------------------------------------------
- int dias, anio, meses, utd, diasR;
- System.out.print("Ingrese el numero (DIAS): " );
- dias = teclado.nextInt();
- meses = 30;
- anio = 365;
- diasR = (dias) / (anio);
- meses = ((dias) % (anio)) / (meses);
- utd = ((meses + 1) % (dias-1)) -1 ;
- System.out.println (dias + " días equivalen a " + diasR + " años, " + meses + " meses y " + utd + " días." );
- System.out.println("EJERCICIO#5");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement