diff --git a/factorialOfNum.java b/factorialOfNum.java new file mode 100644 index 0000000..8e69244 --- /dev/null +++ b/factorialOfNum.java @@ -0,0 +1,20 @@ +import java.io.*; +public class factorialOfNum +{ + public static void main(String arg[]) throws IOException + { + BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); + int n; + int fact=1; + System.out.println("Enter number to calulate factorial"); + + n = Integer.parseInt(in.readLine()); + for(int i=1;i<=n;i++) + { + + fact=fact*i; + } + + System.out.println("factoral of the entered number is "+fact); + } +} \ No newline at end of file