Skip to content

Instantly share code, notes, and snippets.

@TranNgocMinh
Created February 4, 2018 06:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TranNgocMinh/d3049beabeb9628b46d29def8b870ef4 to your computer and use it in GitHub Desktop.
Save TranNgocMinh/d3049beabeb9628b46d29def8b870ef4 to your computer and use it in GitHub Desktop.
import java.util.Scanner;
public class Program {
public static void main(String[] args) {
float a,b;
Scanner scanner = new Scanner( System.in );
System.out.print( "Nhap a = " );
a = Float.parseFloat(scanner.nextLine() );
System.out.print( "Nhap b = " );
b = Float.parseFloat(scanner.nextLine() );
System.out.println("So lon nhat la:" + Max(a,b));
}
public static float Max(float a, float b){
float max = 0;
if(a>b)
max = a;
else
max = b;
return max;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment