{"id":2657,"date":"2017-11-17T18:42:44","date_gmt":"2017-11-17T18:42:44","guid":{"rendered":"http:\/\/webartdevelopers.com\/?p=2657"},"modified":"2017-11-17T18:42:44","modified_gmt":"2017-11-17T18:42:44","slug":"how-to-create-a-program-to-find-a-factorial-of-a-number-using-recursion-in-core-java","status":"publish","type":"post","link":"https:\/\/webartdevelopers.com\/blog\/how-to-create-a-program-to-find-a-factorial-of-a-number-using-recursion-in-core-java\/","title":{"rendered":"How to Create a Program to Find a Factorial of a Number using Recursion in Core Java"},"content":{"rendered":"<p>In this tutorial how to find a Factorial of a number using Recursion in Core Java is shown.<br \/>\nCode:<\/p>\n<p>Recursion.java<\/p>\n<p>class Factorial<br \/>\n{<br \/>\nstatic int fact(int i)<br \/>\n{<br \/>\nif(i&gt;0)<br \/>\n{<br \/>\nreturn i*fact(i-1);<br \/>\n}<br \/>\nelse<br \/>\n{<br \/>\nreturn 1;<br \/>\n}<br \/>\n}<\/p>\n<p>public static void main(String arg[])<br \/>\n{<br \/>\nint no=Integer.parseInt(arg[0]);<br \/>\nSystem.out.println(&#8220;Factorial of &#8220;+no+&#8221; is &#8220;+fact(no));<br \/>\n}<br \/>\n}<\/p>\n<p><a href=\"https:\/\/youtu.be\/ZfytLJ58rA8\">https:\/\/youtu.be\/ZfytLJ58rA8<\/a><\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"In this tutorial how to find a Factorial of a number using Recursion in Core Java is shown. Code: Recursion.java class Factorial { static int fact(int i) { if(i&gt;0) { return i*fact(i-1); } else { return 1; } } public static void main(String arg) { int no=Integer.parseInt(arg); System.out.println(&#8220;Factorial of &#8220;+no+&#8221; is &#8220;+fact(no)); } }<!-- AddThis Advanced Settings generic via filter on get_the_excerpt -->","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[156],"tags":[157,167,168],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/webartdevelopers.com\/blog\/wp-json\/wp\/v2\/posts\/2657"}],"collection":[{"href":"https:\/\/webartdevelopers.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webartdevelopers.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webartdevelopers.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/webartdevelopers.com\/blog\/wp-json\/wp\/v2\/comments?post=2657"}],"version-history":[{"count":1,"href":"https:\/\/webartdevelopers.com\/blog\/wp-json\/wp\/v2\/posts\/2657\/revisions"}],"predecessor-version":[{"id":2658,"href":"https:\/\/webartdevelopers.com\/blog\/wp-json\/wp\/v2\/posts\/2657\/revisions\/2658"}],"wp:attachment":[{"href":"https:\/\/webartdevelopers.com\/blog\/wp-json\/wp\/v2\/media?parent=2657"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webartdevelopers.com\/blog\/wp-json\/wp\/v2\/categories?post=2657"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webartdevelopers.com\/blog\/wp-json\/wp\/v2\/tags?post=2657"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}