This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Exam3 { | |
public static void main(String[] args){ | |
Utility.add(123); | |
Utility.add(987654321); | |
System.out.println("====="); | |
Utility.print("HELLO"); | |
Utility.print("SUT"); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Calculator { | |
public void sumOddIndex(int[] x){ | |
int sum = 0; | |
System.out.print("Sum only "); | |
for(int i = 1; i < x.length; i+=2){ | |
System.out.print(x[i] + " "); | |
sum += x[i]; | |
} | |
System.out.println(" = " + sum); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Collar{ | |
private String colour; | |
Collar(String colour){ | |
this.colour = colour; | |
} | |
public String getColour(){ | |
return colour; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class Carry{ | |
public static void main(String[] a){ | |
Scanner sc = new Scanner(System.in); | |
int[] n1 = new int[200]; | |
int[] n2 = new int[200]; | |
//รับค่าตัวเลขตัวที่ 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
void main(){ | |
int i, j, tmp, k; | |
int x[] = {23, 78, 45, 8, 32, 56}; | |
int n = 6; | |
for(i = 1; i < n; i++){ | |
tmp = x[i]; | |
for(j = i; j > 0 && tmp < x[j-1]; j--){ | |
x[j] = x[j-1]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
void main(){ | |
int i, j, min = 1, tmp; | |
int x[] = {23, 78, 45, 8, 32, 56}; | |
int n = 6; | |
for(i = 0; i < n; i++){ | |
min = i; | |
for(j = i+1; j < n; j++){ | |
min = x[j] < x[min] ? j : min; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
int partition(int [], int, int); | |
void quicksort(int [], int, int); | |
int x[] = {5, 6, 1, 2, 3, 4}; | |
int l = 0, r = 5, i, j; | |
void main(){ | |
quicksort(x, l, r); | |
for(j = 0; j < r+1; j++) | |
printf("%-3d", x[j]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package labtest.no2; | |
import java.util.Scanner; | |
public class No2 { | |
public static void main(String[] args){ | |
Scanner sc = new Scanner(System.in); | |
System.out.print("Enter gen : "); | |
char ch = sc.next().charAt(0); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class No1 { | |
public static void main(String[] args){ | |
Scanner sc = new Scanner(System.in); | |
System.out.print("Enter size: "); | |
int size = sc.nextInt(); | |
int i = 0, n = 1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package oot.lab5.group2.bike; | |
public class Bike { | |
private String brand; | |
private Wheel frontWheel; | |
private Wheel rearWheel; | |
public void setBrand(String brand){ | |
this.brand = brand; | |
} |