Fri Oct 24, 2014 9:44 am
Exercise: Create a Java program that will take a word from a user and shuffle the letters such that it will exchange 2 characters in the word except the first and the last one. To do this exercise use String methods
Wed Oct 29, 2014 1:59 pm
class Factorial {
int fact(int n) {
int result;
if ( n ==1) return 1;
result = fact (n-1) * n;
return result;
}
}
class Recursion {
public static void main (String args[]) {
Factorial f =new Factorial();
System.out.println(“Factorial of 3 is “ + f.fact(3));
System.out.println(“Factorial of 3 is “ + f.fact(4));
System.out.println(“Factorial of 3 is “ + f.fact(5));
}
}
Wed Oct 29, 2014 6:07 pm