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 Ball implements Movable { | |
protected String name; | |
public Ball(){} | |
public Ball(String name){ | |
this.name = name; | |
} | |
@Override | |
public void move(){ |
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> | |
typedef struct nd{ | |
char ch; | |
struct nd *next; | |
}node; | |
node *head = NULL; | |
node *tail = NULL; | |
node *prev = NULL; | |
int count = 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
#include<stdio.h> | |
typedef struct nd{ | |
char ch; | |
struct nd *next; | |
}node; | |
node *head = NULL; | |
int count = 0; | |
void add(char c){ | |
node *n = malloc(sizeof(node)); |
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
Enter a number (1-10) : 11 | |
Enter a number (1-10) : 399 | |
Enter a number (1-10) : 6 | |
6 is even number | |
Enter a number (1-10) : 40 | |
Enter a number (1-10) : -9 | |
Enter a number (1-10) : 3 | |
3 is odd number |
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, n, sum = 0; | |
do{ | |
printf("Enter a Number (5-20) : "); | |
__fpurge(stdin); | |
scanf("%d", &n); | |
if(n < 5 || n > 20) | |
printf("ERROR!!!\n"); |
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 T3 { | |
public static void main(String[] args){ | |
String s = "ABCATACATBDMCATX"; | |
String tmp = s; | |
String key = "CAT"; | |
String result = ""; | |
while(tmp.indexOf(key) != -1){ | |
result += tmp.substring(0, tmp.indexOf(key)); | |
tmp = tmp.substring(tmp.indexOf(key)+3); |
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 T1 { | |
public static void main(String[] args){ | |
String s = "ant:bat:cat:dog:horse:elephant"; | |
for(int i = 0; i < s.length(); i++){ | |
if(s.charAt(i) == ':'){ | |
System.out.println(); | |
}else{ | |
System.out.print(s.charAt(i)); |
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 Student { | |
private String name; | |
private String value; | |
private int subject; | |
private float gpa; | |
public Student(String name, String value){ | |
this.name = name; | |
this.value = value; | |
} |
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 T2 { | |
public static void main(String[] args){ | |
String s = "AB1.2C5.1DEF3.08"; | |
// ทำการ loop เพื่อหาจำนวนของเลขทศนิยมว่ามีกี่ตัว | |
int SIZE = 0; | |
for(int i = 0; i < s.length(); i++){ | |
if(s.charAt(i) == '.'){ | |
SIZE++; | |
} |
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 abstract class Ball implements Rollable, Bouncable{ | |
public abstract void inflate(double volume); | |
public void bounce(float bf){ | |
} | |
public void roll(){ | |
} |