Advertisement
Guest User

Untitled

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