Skip to content

Instantly share code, notes, and snippets.

@nongcybercom
Created August 15, 2011 14:36
Show Gist options
  • Save nongcybercom/1146875 to your computer and use it in GitHub Desktop.
Save nongcybercom/1146875 to your computer and use it in GitHub Desktop.
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
public class Nacket {
public static void main(String[] args) {
//Console console = System.console();
int x=15;
// int x = Integer.valueOf(console.readLine("Enrer number : "));
// int[] n=new int[]
{
List<Integer> list = new LinkedList<Integer>();
for(int i=0;i*6<=x;i++){
for(int j=0;j*9<=x;j++){
for(int k=0;k*20<=x;k++){
System.out.print(i*6+j*9+k*20 + " ");
if(i*6+j*9+k*20 <= x){
list.add(i*6+j*9+k*20);
System.out.println(i*6+j*9+k*20);
}
}
}
System.out.println("");
}
Collections.sort(list);
for(int i : list) System.out.println(i);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment