Saturday, 7 September 2013

Reading a value through key board and printing factorial of a given number


class Fact{
    public static void main(String args[]){

    BufferedReader Br = new BufferedReader(new InputStreamReader(;

    int fact=1;

        System.out.println("Enter a number to find out factorial of a given number: \n" );
        String nu = Br.readLine();
        int n = Integer.parseInt(nu);

        for(int i=2;i<=n;i++)
            System.out.println("Factorial of a given number is:" +fact);

    }catch (IOException err){
            System.out.println("Error reading line");