Skip to content

Instantly share code, notes, and snippets.

@w3farid
Created March 4, 2016 04:26
Show Gist options
  • Save w3farid/956b77f31f6cde485566 to your computer and use it in GitHub Desktop.
Save w3farid/956b77f31f6cde485566 to your computer and use it in GitHub Desktop.
Calculate the largest number among the three number?
import java.util.Scanner;
public class LargestNumberAmongThreeNumber {
public static void main(String[] args) {
Scanner s=new Scanner(System.in);
int a,b,c,d;
System.out.println("Enter all three numbers: ");
a=s.nextInt();
b=s.nextInt();
c=s.nextInt();
d=c>(a>b?a:b)?c:((a>b)?a:b);
System.out.println("Largest Number Is : "+d);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment