Advertisement
keviinrm7

DEBER 1

May 23rd, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.17 KB | None | 0 0
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package m;
  7. import java.util.Scanner;
  8. /**
  9. *
  10. * @author Bryan
  11. */
  12. public class M {
  13.  
  14. /**
  15. * @param args the command line arguments
  16. */
  17. public static void main(String[] args) {
  18. // TODO code application logic here
  19.  
  20. double nota1, nota2, nota3, promedio;
  21. Scanner teclado = new Scanner(System.in);
  22. System.out.print("Ingrese la primera nota: ");
  23. nota1= teclado.nextDouble();
  24. System.out.print("Ingrese la segunda nota: ");
  25. nota2 = teclado.nextDouble();
  26. System.out.print("Ingrese la tercera nota: ");
  27. nota3 = teclado.nextDouble();
  28. promedio= (nota1+ nota2+ nota3)/3;
  29. System.out.println("Su promedio es: " +promedio);
  30. System.out.println("EJERCICIO #1");
  31. //------------------------------------------------------------
  32. int numero,plus , suma=0;
  33. System.out.print ("Ingrese Número: ");
  34. numero = teclado.nextInt();
  35.  
  36. while (numero !=0) {
  37. plus = numero % 10;
  38. numero = numero / 10;
  39. suma = suma + plus;
  40. }
  41. System.out.println( "la suma de cifras es: "+ suma);
  42. System.out.println ("EJERCICIO #2 ");
  43.  
  44. //--------------------------------------------------------------------
  45. float a,p,n,x;
  46.  
  47. System.out.print("Valor depósito Mensual: ");
  48. p = teclado.nextInt();
  49.  
  50. System.out.print("Cantidad de depósitos Mensuales: ");
  51. n = teclado.nextInt();
  52.  
  53. System.out.print("Tasa de interes Mensual: ");
  54. x= teclado.nextFloat();
  55.  
  56. a = (float) (Math.pow((double)(1+x),(double) (x-1)))/x;
  57.  
  58. System.out.println ("El valor acumulado es: "+a);
  59. System.out.println("EJERCICIO #3 ");
  60.  
  61. //----------------------------------------------------------
  62. double radio,h,areat,volumt;
  63.  
  64. System.out.print("Ingrese el valor del radio: ");
  65. radio = teclado.nextDouble();
  66.  
  67. System.out.print("Ingrese valor de la Altura: ");
  68. h = teclado.nextDouble();
  69.  
  70. areat = ((2)*(3.146)*(radio))*(h+radio);
  71. volumt =(3.1416) * (radio*radio)*(h);
  72.  
  73. System.out.println ("El área total de un cilindro es: " + areat+ "cm2" );
  74.  
  75. System.out.println ("El volumen de un cilindro es: " +volumt+ "cm3");
  76. System.out.println("EJERCICIO#4");
  77.  
  78. //-------------------------------------------------------------------------
  79.  
  80. int dias, anio, meses, utd, diasR;
  81. System.out.print("Ingrese el numero (DIAS): " );
  82. dias = teclado.nextInt();
  83.  
  84. meses = 30;
  85. anio = 365;
  86.  
  87. diasR = (dias) / (anio);
  88.  
  89. meses = ((dias) % (anio)) / (meses);
  90.  
  91. utd = ((meses + 1) % (dias-1)) -1 ;
  92.  
  93.  
  94. System.out.println (dias + " días equivalen a " + diasR + " años, " + meses + " meses y " + utd + " días." );
  95. System.out.println("EJERCICIO#5");
  96.  
  97. }
  98.  
  99. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement