Thursday, January 30, 2014

Find biggest of 3 numbers

Write a program to find the biggest of 3 numbers


import java.util.Scanner;

public class biggest

 {

    public static void main(String[] args)
 {

  System.out.println("Enter 3 numbers");

  Scanner sc=new Scanner(System.in);

  int a=sc.nextInt();

  int b=sc.nextInt();

  int c=sc.nextInt();

  int max=a;



  if(b>max)
                      max=b;

  if(c>max)

        max=c;

  System.out.println("The biggest of 3 numbers:"+max);
 }

}



Output:

Enter 3 numbers

65

98

43


The biggest of 3 numbers:98





No comments:

Post a Comment