Java Coding Drill – One

1. Factorial finding public class Fact {        public static int factorial(int n) {            if (n==0)                   return 1;           else                  return n * factorial(n-1);         }        public static void main(String argv[]) {             int x;             x=9;             System.out.println(“Factorial of “+x+” is “+factorial(x));        }} 2. Divisible by number public class Divisor{          public static void main(String[] args){                int a [...]

Follow

Get every new post delivered to your Inbox.