Write a program that prompts the user for two integers and then prints
The sum
The difference
The product
The average
The distance (absolute value of the difference)
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.
**program must be written in Python**
Code:
a=int(input('Enter first number :')) #value of a taken from
user
b=int(input('Enter second number :')) #value of b taken from
user
add=a+b;
difference=a-b;
product=a*b;
distance=difference #(absolute value of the difference)
if(a>b):
maximum=a;
minimum=b;
elif(a<b):
maximum=b;
minimum=a;
print("The sum is %d "%add);
print("The Difference is %d "%difference);
print("The Product is %d "%product);
print("The Distance is %d "%distance);
print("The Maximum Number is %d "%maximum);
print("The Minimum Number is %d "%minimum);
The Output of the code is:
Write a program that prompts the user for two integers and then prints The sum The...
Programming Lab 4 (Chapter 4) There is one checkpoint, make sure you call your professor to get checked. 4.1 Write a program that prompts the user for two integers and then prints The sum The difference The product The average The distance (absolute value of the difference) The maximum (the larger of the two) The minimum (the smaller of the two) Hint: The max, min, and absolute value methods are declared in the Math class. Lookup https://docs.oracle.com/javase/8/docs/api/java/lang/Math. html the API...
in java 3) Sum. Write a program that prompts the user to read two integers and displays their sum. Your program should prompt the user to read the number again if the input is incorrect.
In C++, Write a program that it prompts to user for two integers, computes the quotient of two integers, and then displays the result. You need to do the following things in this assignment: + The main function prompts for user input and reads the two integers that the user entered. + Write a quotient function that computes the quotient of two integers and return the results. (hint: avoid integer division and divide by zero)
Write a program that prompts the user to input three different integers from the keyboard, then prints the sum, the average, and the product. The screen dialogue should appear exactly as follows: Enter three different integers: 13 27 14 Sum is 54 Average is 18 Product is 4914 Please code in c program
In Java - Write a program that prompts the user to enter two integers and displays their sum. If the input is incorrect, prompt the user again. This means that you will have a try-catch inside a loop.
C++ Write a program that prompts the user to enter integers or a sentinel to stop. The program prints the highest and lowest numbers entered, the sum and the average. DO NOT USE ARRAYS, only variables and loops. Write a program the prompts the user to input a positive integer. Keep asking the user until a positive integer is entered. Once a positive integer is entered, print a message if the integer is prime or not. (NOTE: A number is...
Finish the given ProcessFile.java program that prompts the user for a filename and reprompts if file doesn’t exist. You will process through the file skipping any text or real (double) numbers. You will print the max, min, sum, count, and average of the integers in the file. You will want to create test files that contain integers, doubles, and Strings. HINT: Use hasNextInt() method and while loop. You may also want to use Integer.MAX_VALUE and Integer.MIN_VALUE for the initialization of...
IN SPARC ASSEMBLY ONLY, write a program that prompts the user for two numbers and prints the sum. THIS MUST BE IN SPARC ASSEMBLY. DO NOT WRITE IT IN NORMAL ASSEMBLY LANGUAGE. Sample: Enter Number 1: 2 Enter Number 2: 3 The sum of 2 and 3 is 5 Note: -Your program should contain .data, .bss, and .text sections -DO NOT try to optimize your code (i.e remove nops) -DO NOT write this in regular assembly, it must be in...
IN JAVA 1. Create a program that prompts the user for an integer and then displays a message indicating whether or not the number is a perfect square. This can be determined by finding the square root of a number, truncating it (by casting the double result), and then squaring that result 2. Write a program that prompts the user for two numbers. The first number is a minimum value and the second number is a maximum value. RandomNum then...
Write a Python program that prompts the user to enter their three favorite bands separate by commas, and prints their selections on three separate bands. Hint: You will need to use the string function, split. A sample run appears below (user input shown in bold): Enter your favorite bands separated by commas: The Beatles,Queen,Bruce Springsteen My favorite bands are: The Beatles Queen Bruce Springsteen