Programming
Python
R
Java
C
C++
C#
WEB
HTML
CSS
JavaScript
BootStrap4
jQuery
SVG
MORE
Examples1
Python
GO
R
Java
C
C++
C#
Examples2
Python
R
Java
C
C++
C#
HTML
CSS
JavaScript
BootStrap4
jQuery
SVG
Seo Tools
Code Minifier
Code Beautifier
Language Compiler
Misc Tools
File Converter
References
C
C++
Python
Java
PHP
JavaScript
Examples
Python
R
Java
C
C++
C#
HTML
CSS
JavaScript
BootStrap4
jQuery
SVG
Home
About
Contact
JetPack
Multi Themes-->>
Code it ALL
Scroll TOP
Java Program to Find the Largest Among Three Numbers - CodeGK
Δ Java Examples
Examples
Java Program to Add Two Integers
Java Program to Multiply two Floating Point Numbers
Java Program to Find ASCII Value of a character
Java Program to Find Character from it's Ascii Value
Java Program to Compute Quotient and Remainder
Java Program to Swap Two Numbers
Java Program to Check Whether a Number is Even or Odd
Java Program to Check Whether an Alphabet is Vowel or Consonant
Java Program to Find the Largest Among Three Numbers
Java Program to Find all Roots of a Quadratic Equation
Java Program to Check Leap Year
♦ Java Program to Find the Largest Among Three Numbers
♣ Example1: Java Program to Find the Largest Among Three Numbers
Input:
Run CODE
Reload Code
Copy Code
public class MyClass { static int maxThree(int a, int b, int c){ int max; if(a>=b){ max=a; } else{ max=b; } if(max>=c){ System.out.println(max+" is largest among "+a +","+b+ " and " +c); return max; } else{ max=c; System.out.println(max+" is largest among "+a +","+b+ " and " +c); return max; } } public static void main(String[] args) { int a=5,b=7,c=1; maxThree(a, b, c); } }
Output: