Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Principal {
- public static void main(String[] args){
- Scanner teclado=new Scanner(System.in);
- int i,n,fac=1;
- System.out.println("PROGRAMA DONDE EL USUARIO DIGITE NUMEROS POSITIVOS Y ENTEROS Y EL PC DEBE DE MOSTRAR EL FACTORIAL DEL NUMERO DIGITADOS");
- System.out.println("Ingrese el numero");
- n=teclado.nextInt();
- i=n;
- while (i>0){
- fac=fac*i;
- i--;
- }
- System.out.println("el factorial de "+n+" es: "+fac);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement