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 t,n=0,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=teclado1.nextInt();
- for (int i =n;i>0;i--){
- fac=fac*i;
- }
- System.out.println("el factorial de "+n+" es: "+fac);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement