Computer Science, asked by ankitprasad8777, 1 month ago

1. Write a program in Java to display the greatest of the three numbers by taking user input. [Sample Input: 25 45 12 Sample Output: 45]​

Answers

Answered by suvendu1274
1

Explanation:

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);

}

}

Mark me brainliest plz

Similar questions