Computer Science, asked by saanvib13, 2 months ago

Write a program to find the smallest of three numbers using if else if in java​

Answers

Answered by kamalrajatjoshi94
2

Answer:

Program:-

import java.util.*;

public class Smallest

{

public static void main(String args[ ])

{

Scanner in=new Scanner(System.in);

int a,b,c;

System.out.println("Enter the numbers");

a=in.nextInt();

b=in.nextInt();

c=in.nextInt();

if(a<b&&a<c)

{

System.out.println("The smallest number="+a);

}

else if(b<a&&b<c)

{

System.out.println("The smallest number="+b);

}

else if(c<a&&c<b)

{

System.out.println("The smallest number="+c);

}

}

}

Answered by pattanaikbiswaroopby
1

Answer:

public class smallest

{

public void small(int a, int b, int c)

{

int min=0;

if(a<b&&a<c)

min=a;

elseif(b<c)

min=b;

else

min=c;

System.out.println(min+"is the smallest number");

}

}

Similar questions