Computer Science, asked by harshkmishra12345, 21 hours ago

Write a program to accept three unequal number from the user and print greatest and least among them
Also explain how to run the program in any android app
Pls it's urgent​​

Answers

Answered by sy2681770
1

Answer:

import java.util.Scanner;

public class KboatMinMaxNumbers

{

public static void main(String args[]) {

Scanner in = new Scanner(System.in);

System.out.println("Enter 3 unequal numbers");

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 min = a, max = a;

min = b < min ? b : min;

min = c < min ? c : min;

max = b > max ? b : max;

max = c > max ? c : max;

System.out.println("Greatest Number: " + max);

System.out.println("Smallest Number: " + min);

}

}

Answered by purveshKolhe
2

\huge{\green{\boxed{\mathfrak{\red{ answer : }}}}}

JAVA::

import java.util.Scanner;

public class Brainly {

public static void main(String [] args) {

Scanner sc = new Scanner(System.in);

int n = sc.nextInt();

int l = sc.nextInt();

int k = sc.nextInt();

int lol = Math.max(n,Math.max(l,k));

int kok = Math.min(n,Math.min(l,k));

System.out.println("Maximum number : " + lol);

System.out.println("Minimum number is : " + kok);

}

}

Logic::

==> We imported a scanner, and took three inputs and then found the maximum and the minimum numbers storing in two variables.

==> Then we printed on two lines and concatenate it with the output.

==> Hurrah, the program is finished!!!

I hope that my answer helps you...

Similar questions