Computer Science, asked by Gucock, 1 month ago

Write a Program to input 3 numbers and print the maximum and minimum number using math function(don’t use if,else)​

Answers

Answered by dhanansangee
1

Answer: The answer for this question is:

public class LargestAndSmallest {2  3

public void fin(int a, int b, int c) {

4

int max = a;

5

if (b > max) {

6

max = b;

7

}

8

if (c > max) {

9

max = c;

10

}

11

int min = a;

12

if (b < min) {

13

min = b;

14

}

15

if (c < min) {

16

min = c;

17

}

18

System.out.println("Largest of the three numbers is " + max);

19

System.out.println("Smallest of the three numbers is " + min);

20

}

21

}

Hope this answer helps you my dear friend!

Similar questions