Computer Science, asked by ashishbhagat78, 3 months ago

wap to input 3 numbers and find the smallest of them using scanner class​

Answers

Answered by chayan07
2

Program in java :

package (give package name);

import java.util.*;

public class (give class name)

{

public static void main(String[] args)

{

Scanner sc=new Scanner(System.in);

System.out.print("Enter first number : ");

double a=sc.nextDouble();

System.out.print("Enter second number : ");

double b=sc.nextDouble();

System.out.print("Enter third number : ");

double c=sc.nextDouble();

if ((a>b)&&(a>c))

System.out.println(a+" is the greatest number.");

else

if ((b>a)&&(b>c))

System.out.println(b+" is the greatest number.");

else

if ((c>a)&&(c>b))

System.out.println(c+" is the greatest number.");

}

}

I have done the program using double variable. You can do using Integer also.

Similar questions