Skip to content

Instantly share code, notes, and snippets.

View hyperion0201's full-sized avatar

Hieu Hoang hyperion0201

View GitHub Profile
@hyperion0201
hyperion0201 / eqn2.java
Created September 1, 2017 07:43
Equal level 2 solution (JAVA)
import java.util.*;
import javax.swing.*;
import java.lang.Math.*;
import java.text.*;
class Eqn2 {
public static void Solve(int a, int b, int c) {
double delta = b*b-(4*a*c);
if (delta < 0) {
System.out.println("No solution !");
}
@hyperion0201
hyperion0201 / Height.java
Created September 5, 2017 06:59
Troll height estimated
import java.util.*;
import javax.swing.*;
class Height {
public static void main(String[] args) {
JFrame myFrame = new JFrame();
myFrame.setSize(500, 300);
myFrame.setTitle("Ung dung do chieu cao cua ban ");
myFrame.setVisible(true);
myFrame.getIconImage();
String str = JOptionPane.showInputDialog(myFrame, "Nhap vao chieu cao cua ban (cm) : ");
@hyperion0201
hyperion0201 / SpellInt.java
Created September 5, 2017 07:03
Algorithm Int Spell based Vietnamese lang.
import java.util.*;
import javax.swing.*;
class SpellInt { // Class init
public static void Spell(int n) {
String str1, str2, str3, str4;
str1 = "ngan";
str2 = "tram";
str3 = "chuc";
str4 = "don vi";
int x, y, j, k;
@hyperion0201
hyperion0201 / MinMax.java
Last active September 5, 2017 07:03
JAVA Algorithm find Min, Max merge from 2 num <100.
// Chuong trinh tim so lon nhat va so be nhat tao thanh tu 2 so nguyen 2 chu so
import javax.swing.*;
import java.util.*;
class MinMax {
public static void swapFunction(int[] a, int n) { // Initialising the Array Swapping Function
for (int i = 0; i < n; i++) {
for (int j = (i+1); j < n; j++) {
if (a[i] > a[j]) {
int temp = a[i];
a[i] = a[j];
@hyperion0201
hyperion0201 / triangle.java
Created September 5, 2017 07:05
Right-Angled Triangle create by a num.
import java.util.*;
//import javax.swing.*;
class Square{
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.println("Nhap vao so n : ");
int n = scan.nextInt();
for (int i = 0; i <= n; i++) {
for (int j = i; j<=(n-1); j++ ) {
@hyperion0201
hyperion0201 / testclass.java
Created September 5, 2017 07:07
The java classes for testing.
import java.util.*;
class Student { // Initialising the main class
int studentage;
public Student(String name) {
System.out.println("Name choosen is : " + name);
}
public void setAge(int age) {
studentage = age;
@hyperion0201
hyperion0201 / Backsee.java
Created September 6, 2017 06:06
JAVA Backsee Int algorithm.
import java.util.*;
class Backsee{
public static void Process(int a){
int x;
for (int i = 10; i <= a;){
x = a%i;
a = a/i;
System.out.print(x);
}
System.out.print(a);
@hyperion0201
hyperion0201 / FirstInt.c
Created September 6, 2017 14:37
C algorithm declare first num character in a Int
#include <stdio.h>
void Process(int a){
int n;
for (int i = 10; i <=a;){
a = a/10;
}
printf("Chu so dau tien cua so a la : %d ", a);
}
void main() {
int a;
@hyperion0201
hyperion0201 / ritcheckwithfloat.c
Created September 12, 2017 10:12
Right Isosceles Triangle with Float Variables check in C
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
void CheckSST(float a, float b, float c) {
float aceil = ceilf(a*a*10)/10;
float bceil = ceilf(b*b*10)/10;
float cceil = ceilf(c*c*10)/10;
if (a==b && ceilf((a*a+b*b)*10)/10 == cceil) {
printf("Passed !\n");
}
@hyperion0201
hyperion0201 / Ham.cpp
Created October 21, 2017 15:37
1760311_BTVN_Tuan06 - Bai06
#include "Ham.h"
int CheckLeap(int year){
int leap;
if (year % 4 == 0 || (year % 4 == 0 && year % 100 != 0)) leap = 1;
else leap = 0;
return leap;
}
int DayInMonth(int month, int year){
int nday;
switch (month)