Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


k.jahangir kumar
javaprograms
1 Answer(s)      3 years and a month ago
Posted in : Java Beginners


please help in this java program.... 2345 1345 1245 1235 1234


Advertisement
View Answers

August 30, 2011 at 12:28 PM


public class UniqueCombinations {
    public static void find(String s) { find("", s); }
    private static void find(String prefix, String s) {
        if(prefix.length()==4){
        System.out.println(prefix);
        }
        for (int i = 0; i < s.length(); i++)
            find(prefix + s.charAt(i), s.substring(i + 1));

    }  
    public static void main(String[] args) {
       String st = "12345";
       find(st);
       System.out.println();
      }
}


Related Tutorials/Questions & Answers:
Advertisements
Advertisements
 

 

 

DMCA.com