Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file addedBubble.class
Binary file not shown.
23 changes: 23 additions & 0 deletions Bubble.java
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
public class Bubble{
public static void main(String[] args){
int n=args.length;
int[] array;
array=new int[n];
for(int i=0;i<n;i++){
array[i]=Integer.parseInt(args[i]);
}
for(int i=0;i<n-1;i++){
for(int j=0;j<n-i-1;j++){
if(array[j]>array[j+1]){
int temp=array[j];
array[j]=array[j+1];
array[j+1]=temp;
}
}
}
for(int i=0;i<n;i++){
System.out.print(array[i]+" ");
}
System.out.println("");
}
}
Binary file addedCalendar.class
Binary file not shown.
20 changes: 20 additions & 0 deletions Calendar.java
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
public class Calendar{
public static void main(String[] args){
int month= Integer.parseInt(args[0]);
switch(month){
case 1: System.out.println("Januari"); break;
case 2: System.out.println("Februari"); break;
case 3: System.out.println("Maret"); break;
case 4: System.out.println("April"); break;
case 5: System.out.println("Mei"); break;
case 6: System.out.println("Juni"); break;
case 7: System.out.println("Juli"); break;
case 8: System.out.println("Agustus"); break;
case 9: System.out.println("September"); break;
case 10: System.out.println("Oktober"); break;
case 11: System.out.println("November"); break;
case 12: System.out.println("Desember"); break;
default: System.out.println("Out of box!");
}
}
}
Binary file addedCalendarDay.class
Binary file not shown.
21 changes: 21 additions & 0 deletions CalendarDay.java
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
public class CalendarDay{
public static void main(String[] args){
int year=Integer.parseInt(args[0]);
int month=Integer.parseInt(args[1]);
switch(month){
case 1: System.out.println("31"); break;
case 2: if(year%4==0) System.out.println("29"); else System.out.println("28"); break;
case 3: System.out.println("31"); break;
case 4: System.out.println("30"); break;
case 5: System.out.println("31"); break;
case 6: System.out.println("30"); break;
case 7: System.out.println("31"); break;
case 8: System.out.println("31"); break;
case 9: System.out.println("30"); break;
case 10: System.out.println("31"); break;
case 11: System.out.println("30"); break;
case 12: System.out.println("31"); break;
default: System.out.println("Out of box!");
}
}
}
Binary file addedFacRecursive.class
Binary file not shown.
10 changes: 10 additions & 0 deletions FacRecursive.java
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
public class FacRecursive{
public static void main(String[] args){
int number=Integer.parseInt(args[0]);
System.out.println(Recursive(number));
}
public static int Recursive(int n){
if(n>1) return n*(Recursive(n-1));
else return n;
}
}
Binary file addedFactorial.class
Binary file not shown.
14 changes: 14 additions & 0 deletions Factorial.java
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
public class Factorial{
public static void main(String[] args){
int number=Integer.parseInt(args[0]);
int result=1;
for(int i=2;i<=number;i++){
if(number==0){
result=0;
break;
}
result*=i;
}
System.out.println(result);
}
}
Binary file addedHelloWorld.class
Binary file not shown.
20 changes: 20 additions & 0 deletions HelloWorld.java
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
public class HelloWorld{
public static void main(String[] args){
int score= Integer.parseInt(args[0]);
if(score>80){
System.out.println("A");
}
else if(score>70){
System.out.println("B");
}
else if(score>60){
System.out.println("C");
}
else if(score>50){
System.out.println("D");
}
else{
System.out.println("E");
}
}
}