public class solve
{
public static void main( String args[] )
{
// create Scanner to obtain input from command window
Scanner input = new Scanner( System.in );
int x; // first number input by user
int y; // second number input by user
int z; // third number input by user
int a; // fourth number input by user
int result; // output of product
int result1;
int min;
int max;
System.out.print( "Enter first integer: " ); // prompt for input
x = input.nextInt(); // read first integer
System.out.print( "Enter second integer: " ); // prompt for input
y = input.nextInt(); // read second integer
System.out.print( "Enter third integer: " ); // prompt for input
z = input.nextInt(); // read third integer
System.out.print ("Enter fourth integer: " ); // prompt for input
a = input.nextInt (); // read fourth integer
result = x + y + z + a; // calculate product of numbers
result1 = x * y * z * a;
min = x;
if (y < x)
min = y;
if (z < y)
min = z;
if (a < z);
min = a;
max = x;
if (y > x)
max = y;
if (z > y)
max = z;
if (a > z);
max = a;
System.out.printf( "Sum is %d\n", result );
System.out.printf( "Product is %d\n", result1 );
System.out.printf( "Minimum is: " , min );
System.out.printf( "Maximum is: " , max );
2006-10-12
18:10:49
·
3 answers
·
asked by
azhi_saleem
1
in
Computers & Internet
➔ Programming & Design