Computer Science, asked by SatyanshPandit, 1 month ago

write a program in java to accept three numbers from user and find the middle one​

Answers

Answered by llmiss4ll
1

Answer:

\huge \sf (\orange {\underline {\pink{\underline (A᭄ɴsᴡᴇʀ࿐ \ :-}}

import java.util.Scanner;

public class Exercise3 {

public static void main(String[] args) {

Scanner in = new Scanner(System.in);

System.out.print("Input the 1st number: ");

int num1 = in.nextInt();

System.out.print("Input the 2nd number: ");

int num2 = in.nextInt();

System.out.print("Input the 3rd number: ");

int num3 = in.nextInt();

if (num1 > num2)

if (num1 > num3)

System.out.println("The greatest: " + num1);

if (num2 > num1)

if (num2 > num3)

System.out.println("The greatest: " + num2);

if (num3 > num1)

if (num3 > num2)

System.out.println("The greatest: " + num3);

}

}

Similar questions