Computer Science, asked by javariaaslam266, 19 days ago

4: Write a program that prompts the user for two integers and then prints

• The sum

• The difference

• The product

• The average

• The maximum (the larger of the two)

• The minimum (the smaller of the two)
Hint: Python defines max and min functions that accept a sequence of values, each separated with a comma.​

Answers

Answered by rk1946343
4

abcdefghijklmnopqrstuvwxyz

Answered by anushasarugari9
1

Answer:

import java.util.Scanner;

public class Exercise9 {

   public static void main(String[] args)

   {

       Scanner in = new Scanner(System.in);

       System.out.print("Input 1st integer: ");

       int firstInt = in.nextInt();

       System.out.print("Input 2nd integer: ");

       int secondInt = in.nextInt();

       System.out.printf("Sum of two integers: %d%n", firstInt + secondInt);

       System.out.printf("Difference of two integers: %d%n", firstInt - secondInt);

       System.out.printf("Product of two integers: %d%n", firstInt * secondInt);

       System.out.printf("Average of two integers: %.2f%n", (double) (firstInt + secondInt) / 2);

       System.out.printf("Distance of two integers: %d%n", Math.abs(firstInt - secondInt));

       System.out.printf("Max integer: %d%n", Math.max(firstInt, secondInt));

       System.out.printf("Min integer: %d%n", Math.min(firstInt, secondInt));

   }

}

Explanation:

I hope it helped

Similar questions