October 4, 2012 / IST / Language.

Write a program to find which number is maximum.

import java.util.Scanner;
public class MaximumFinder
{
 public void determineMax()
 {
  Scanner input=new Scanner(System.in);
  double a,b,c,maximum;
  System.out.print("Enter 3 numbers : ");
  a=input.nextDouble();
  b=input.nextDouble();
  c=input.nextDouble();
  maximum=max(a,b,c);
  System.out.println(maximum);
 }

 public double max(double a,double b,double c)
 {
  double k=0;
  if (a>b && a>c)
   k=a;
  else if(b>c)
    k=b;
  else
     k=c;
  return k;
 }
}