Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package crediti;
- import java.util.*;
- public class Fattoriale {
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- int n;
- float f = 1;
- Scanner input;
- input= new Scanner(System.in);
- System.out.println("input n");
- n=input.nextInt();
- f=n;
- while(n>1){
- n=n-1;
- f=f*n;
- }
- System.out.println("fattoriale: "+f);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment