Advertisement
Guest User

Untitled

a guest
Apr 28th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.58 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3.  
  4. public class Principal {
  5.     public static void main(String[] args){
  6.         Scanner teclado=new Scanner(System.in);
  7.            int i,n,fac=1;
  8. System.out.println("PROGRAMA DONDE EL USUARIO DIGITE NUMEROS POSITIVOS Y ENTEROS Y EL PC DEBE DE MOSTRAR EL FACTORIAL DEL NUMERO DIGITADOS");
  9.         System.out.println("Ingrese el numero");
  10.         n=teclado.nextInt();
  11.         i=n;
  12.         while (i>0){
  13.            
  14.        
  15.      
  16.             fac=fac*i;
  17.             i--;
  18.         }
  19.             System.out.println("el factorial de "+n+" es: "+fac);      
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement