(SPOJ) 3774 - Fatorial - Solução

import java.io.*;
import java.util.*;
import java.lang.Math;
import java.math.*;

class Main {
    public static void main(String[] args) throws NumberFormatException, IOException {
        Main processando = new Main();
        processando.processa();
       
        System.exit(0);
    }
   
    void processa() throws NumberFormatException, IOException {
        String line = "";
       
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
       
        line = br.readLine();
        StringTokenizer tokenizer = new StringTokenizer(line);
       
        int valor = Integer.valueOf(tokenizer.nextToken());
           
        int multiplica = 1;
        for (int i = 1; i <= valor; i++) {
            multiplica *= i;
        }
       
        System.out.println(multiplica);
           
        return;
    }
}

Comments

Popular posts from this blog

(Coderbyte) Dash Insert II - Solução

(Coderbyte) Run Length - Solução

(Coderbyte) Counting Minutes I - Solução