Custom Search

Sunday 9 September 2012

JAVA program to find greatest of 2 numbers

Author: Sanif S S
Site: theeduzone.blogspot.com
Email: sanifss@gmail.com





<
 import java.util.*;
 class Greatest2
{
public static void main(String[] ar)
{
Scanner s=new Scanner(System.in);
int a,b;
System.out.println(“Enter 2 numbers”);
a=s.nextInt();
b=s.nextInt();
if(a>b)
System.out.println(“A is Greater”);
else if(a==b)
System.out.println(“Both are equal”);
else
System.out.println(“B is Greater”);

}



No comments:

Post a Comment

LinkWithin

Related Posts Plugin for WordPress, Blogger...