2:21 am - Friday April 19, 2019

Java Example Program to find the smallest of two numbers

CANDID INDUSTRIAL TRAINING -- CHENNAI
Corporate Training for Experienced Candidate
Struts | Hibernate | Spring | Java / J2EE
SOAP | RestFull | Design Pattern | more...
Ph: +91 72000 69003
137b, 2nd st, shanthi nagar, Chrompet, Chennai -600044
//Java Example Program to find the smallest of two numbers
/**
 * @author:candidjava.com
 * @description:Program to find the smallest of two numbers
 */
public class Smallest {
	public static void main(String args[]) {
		int a, b;
		a = 35;// input of first value
		System.out.println("enter first value " + "a=" + a);
		b = 46;// input of second value
		System.out.println("enter second value " + "b=" + b);

		if (a > b)// condition to find smallest
		{
			System.out.println("smallest number is " + b);
		} else {
			System.out.println("smallest number is " + a);
		}
	}
}

output:
enter first value a=35
enter second value b=46
smallest number is 35

Filed in: Z-A All Java Codes

Comments are closed.