HRida
Oct 23, 2011, 02:18 PM
//the question is below at final
Package assignment2_1;
Import java.util.Scanner;
Public class Assignment2_1
{ public static void main(String[] args)
{
System.out.println("Enter your 3 numeric values");
System.out.println("Note: this program purpose is to find the minimum and maximum value of what you enter");
Scanner scan= new Scanner(System.in);
int firstNumericValue,secondNumericValue,thirdNumericV alue;
System.out.println("Enter your first numeric value:");
firstNumericValue=scan.nextInt();
System.out.println("Enter your second numeric value:");
secondNumericValue=scan.nextInt();
System.out.println("Enter your third numeric value:");
thirdNumericValue=scan.nextInt();
int max,min;
if((firstNumericValue>secondNumericValue)&&(firstNumericValue>thirdNumericValue)&&(secondNumericValue>thirdNumericValue))
{
max=firstNumericValue;
min=thirdNumericValue;
}
Else if((firstNumericValue>secondNumericValue)&&(firstNumericValue>thirdNumericValue)&&(secondNumericValue<thirdNumericValue))
{
max=firstNumericValue;
min=secondNumericValue;
}
Else if((secondNumericValue>firstNumericValue)&&(secondNumericValue>thirdNumericValue)&&(firstNumericValue>thirdNumericValue))
{
max=secondNumericValue;
min=thirdNumericValue;
}
Else if((secondNumericValue>firstNumericValue)&&(secondNumericValue>thirdNumericValue)&&(firstNumericValue<thirdNumericValue))
{
max=secondNumericValue;
min=firstNumericValue;
}
Else if((thirdNumericValue>firstNumericValue)&&(thirdNumericValue>secondNumericValue)&&(firstNumericValue>secondNumericValue))
{
max=thirdNumericValue;
min=secondNumericValue;
}
Else if((thirdNumericValue>firstNumericValue)&&(thirdNumericValue>secondNumericValue)&&(firstNumericValue<secondNumericValue))
{
max=thirdNumericValue;
min=firstNumericValue;
}
If(max%min==0){System.out.println(max "divisible by" min);}
Else {System.out.println("The #s are not divisible by each others.");}
//this is like C how I can make it in java ?
}
}
Package assignment2_1;
Import java.util.Scanner;
Public class Assignment2_1
{ public static void main(String[] args)
{
System.out.println("Enter your 3 numeric values");
System.out.println("Note: this program purpose is to find the minimum and maximum value of what you enter");
Scanner scan= new Scanner(System.in);
int firstNumericValue,secondNumericValue,thirdNumericV alue;
System.out.println("Enter your first numeric value:");
firstNumericValue=scan.nextInt();
System.out.println("Enter your second numeric value:");
secondNumericValue=scan.nextInt();
System.out.println("Enter your third numeric value:");
thirdNumericValue=scan.nextInt();
int max,min;
if((firstNumericValue>secondNumericValue)&&(firstNumericValue>thirdNumericValue)&&(secondNumericValue>thirdNumericValue))
{
max=firstNumericValue;
min=thirdNumericValue;
}
Else if((firstNumericValue>secondNumericValue)&&(firstNumericValue>thirdNumericValue)&&(secondNumericValue<thirdNumericValue))
{
max=firstNumericValue;
min=secondNumericValue;
}
Else if((secondNumericValue>firstNumericValue)&&(secondNumericValue>thirdNumericValue)&&(firstNumericValue>thirdNumericValue))
{
max=secondNumericValue;
min=thirdNumericValue;
}
Else if((secondNumericValue>firstNumericValue)&&(secondNumericValue>thirdNumericValue)&&(firstNumericValue<thirdNumericValue))
{
max=secondNumericValue;
min=firstNumericValue;
}
Else if((thirdNumericValue>firstNumericValue)&&(thirdNumericValue>secondNumericValue)&&(firstNumericValue>secondNumericValue))
{
max=thirdNumericValue;
min=secondNumericValue;
}
Else if((thirdNumericValue>firstNumericValue)&&(thirdNumericValue>secondNumericValue)&&(firstNumericValue<secondNumericValue))
{
max=thirdNumericValue;
min=firstNumericValue;
}
If(max%min==0){System.out.println(max "divisible by" min);}
Else {System.out.println("The #s are not divisible by each others.");}
//this is like C how I can make it in java ?
}
}