Program 7:: Max and Min

// Program 7:: Write a Program to find max and min of two integer

//

import java.io.*;

class min_max

{

public static void main(String args[])

{

DataInputStream in=new DataInputStream(System.in);

int a=0;

int b=0;

int c=0;

try

{

System.out.print(“Enter 1st number=”);

a = Integer.parseInt(in.readLine());

System.out.print(“Enter 2nd number=”);

b = Integer.parseInt(in.readLine());

}

catch(Exception e){}

c=(a>b?a:b);

System.out.println(“Maximum number is=”+c);

c=(a<b?a:b);

System.out.println(“Minimum number is=”+c);

}

}

// Engr. Parag Ferdus 01713 400 421, 01914 949 399, 01670 876 388

// www.pfbd.yolasite.com paragferdus@gmail.com

Leave a Comment

Your email address will not be published.