diff options
author | bd-912 <bdunahu@colostate.edu> | 2024-04-26 23:33:15 -0600 |
---|---|---|
committer | bd-912 <bdunahu@colostate.edu> | 2024-04-26 23:33:15 -0600 |
commit | ff12bb1dd11c509fc7ac7529085df2d2407b0ece (patch) | |
tree | 81becf519d2027b7729fee73cde49137f22ebbef /output/Factorial.java | |
parent | 5db69446e6e898129c28bea19fbb8bb111c5101c (diff) |
Add my test library
Diffstat (limited to 'output/Factorial.java')
-rw-r--r-- | output/Factorial.java | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/output/Factorial.java b/output/Factorial.java new file mode 100644 index 0000000..d938bb6 --- /dev/null +++ b/output/Factorial.java @@ -0,0 +1,16 @@ +class Factorial{
+ public static void main(String[] a){
+ System.out.println(new Fac().ComputeFac(10));
+ }
+}
+
+class Fac {
+ public int ComputeFac(int num){
+ int num_aux ;
+ if (num < 1)
+ num_aux = 1 ;
+ else
+ num_aux = num * (this.ComputeFac(num-1)) ;
+ return num_aux ;
+ }
+}
|