Computer Science, asked by khalidk320, 4 days ago

Write an algorithm to read two numbers then display the smallest

Answers

Answered by samarthkrv
0

Answer:

import java.util.Scanner;

public class Main

{

public static void main(String[] args) {

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

 Scanner s = new Scanner(System.in);

 int a = s.nextInt();

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

 int b = s.nextInt();

     if(a < b)

     {

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

     }

     else

     {

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

     }

}

}

Explanation:

Similar questions