write a program to input three number and display the largest and smallest among them using method of maths class
Answers
Answered by
0
Answer:
import java.util.Scanner; public class KboatGreatestNumber { public static void main(String args[]) { Scanner in = new Scanner(System.in); System.out.print("Enter First Number: "); int a = in.nextInt(); System.out.print("Enter Second Number: "); int b = in.nextInt(); System.out.print("Enter Third Number: "); int c = in.nextInt(); int g = Math.max(a, b); g = Math.max(g, c); int s = Math.min(a, b); s = Math.min(s, c); System.out.println("Greatest Number = " + g); System.out.println("Smallest Number = " + s); } }
OUTPUT

Similar questions
Chemistry,
27 days ago
Hindi,
1 month ago
Math,
1 month ago
Math,
8 months ago
Psychology,
8 months ago