Skip to content

Instantly share code, notes, and snippets.

@edinak1
Created October 23, 2015 10:15
Show Gist options
  • Select an option

  • Save edinak1/589d99edbdd7bdbf272f to your computer and use it in GitHub Desktop.

Select an option

Save edinak1/589d99edbdd7bdbf272f to your computer and use it in GitHub Desktop.
package metod;
public class Min {
public static void main(String[] args) {
int a=7,b=-2, c =7;
System.out.println("Minimum = " + min(a,b,c));
a=-23; b=-2; c =9;
System.out.println("Minimum = " + min(a,b,c));
a=7; b=2; c =0;
System.out.println("Minimum = " + min(a,b,c));
}
static int min(int a,int b,int c)
{
if(a<=b && a<=c )
return a;
else
if(b<=a && b<=c)
return b;
return c;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment