Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Vettori1 {
- public static void main(String[] args) {
- Scanner utente = new Scanner(System.in);
- long vettore[];
- vettore = new long[10];
- for (int i = 0; i <= vettore.length - 1; i++) {
- System.out.print("Inserisci il valore per la cella numero : " + (i + 1) + " ");
- vettore[i] = Integer.parseInt(utente.nextLine());
- }
- long fattoriale;
- for (int i = 0; i <= vettore.length - 1; i++) {
- fattoriale = vettore[i] - 1;
- while (fattoriale != 0) {
- vettore[i] = vettore[i] * fattoriale;
- fattoriale--;
- }
- }
- for (int i = 0; i <= vettore.length - 1; i++) {
- System.out.println("Il valore della cella : " + (i + 1) + " รจ : " + vettore[i]);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement