Advertisement
Guest User

Untitled

a guest
Apr 26th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. package javaapplication2;
  2. import java.util.Scanner;
  3.  
  4. public class JavaApplication2 {
  5.  
  6.  
  7. public static void main(String[] args) {
  8. Scanner Entrada = new Scanner(System.in);
  9.  
  10. int a, b, serie, cont, n;
  11.  
  12. System.out.print("Cuántos números de la serie quiere calcular");
  13. n = Entrada.nextInt();
  14.  
  15. serie=1;
  16. cont=0;
  17. b=1;
  18. while(cont < n){
  19. if(n % 2 != 0){
  20. a = 0;
  21. while(a < n){
  22. n = n * (n - 1);
  23. a++;
  24. }
  25. }
  26. serie = serie * (b + n);
  27. cont++;
  28. }
  29. System.out.print(serie);
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement