Advertisement
Guest User

Untitled

a guest
Apr 26th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 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 ciclo.anidado;
  7.  
  8. /**
  9. *
  10. * @author baesparza
  11. */
  12. public class CicloAnidado {
  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. //Variables
  21. int i, j, resultado = 1, total = 1, k;
  22.  
  23. //Proceso
  24. i = 1;
  25. while (i <= 6) {
  26.  
  27. if (i % 2 != 0 ) {
  28. k = 0;
  29. while(k <= i){
  30. total = total * k ;
  31. k++;
  32. }
  33. j = total;
  34.  
  35. } else {
  36. j = (7 - i);
  37. }
  38.  
  39.  
  40. resultado = resultado * (i + j);
  41. i++;
  42.  
  43. }
  44.  
  45. //Salida de datos
  46. System.out.println("El resultado es "+ resultado);
  47. }
  48.  
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement