Advertisement
Guest User

Untitled

a guest
Apr 26th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. package javaapplication4;
  2.  
  3. import java.util.Scanner;
  4. public class JavaApplication4 {
  5.  
  6.  
  7. public static void main(String[] args) {
  8. Scanner entrada = new Scanner(System.in);
  9. //creacion de variables
  10. int num,i=1,resul=1;
  11. //Ingreso de datos por el usuario
  12. System.out.println("Ingrese el número del que desee sacar el factorial ");
  13. num=entrada.nextInt();
  14. while(i<=num){
  15. resul=resul*i;
  16. i++;
  17. }
  18. System.out.println("el factorial de su número ingresado es:" +resul);
  19. }
  20.  
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement