Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package pkgfor;
- import java.util.Scanner;
- public class For {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- int qtd,i,num,fatorial,j;
- System.out.println("Digite a quantidade de números para serem lidos: ");
- qtd = sc.nextInt();
- for(i=1;i<=qtd;i++){
- System.out.println("Digite o " +i+ "º número:");
- num = sc.nextInt();
- fatorial = 1;
- for (j=1;j<=num;j++)
- fatorial = fatorial * j;
- System.out.println("O fatorial de "+num+" é: "+fatorial);
- }
- }
- }
- // receber uma x quantidade de numeros
- // essa quantidade de numeros vai ser de escolha do usuario
- // os numeros escolhidos deveram ser mostrado o fatorial.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement