/* file 1 Packclass.java */
package P;
public class Packclass
{
public int findmax(int a,int b,int c)
{
int max = (a>b)? ((a>c)? a:c) : ((b>c)? b:c);
return max;
}
}
---------------------------------------------------------------------------
/* file 2 Program1.java */
import P.Packclass;
import java.util.*;
class Program1
{
public static void main(String args[])
{
Packclass p1 = new Packclass();
Scanner sc = new Scanner(System.in);
System.out.print("enter three number: ");
int a = sc.nextInt();
int b = sc.nextInt();
int c = sc.nextInt();
System.out.println("\nmaximum number is: "+ p1.findmax(a,b,c));
}
}
No comments:
Post a Comment