Question

Java program: Print the sum, difference, and product of 2 numbers without using variables.

Java program: Print the sum, difference, and product of 2 numbers without using variables.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Program

public class Main
{
public static void main(String[] args)
{
  System.out.println("Sum :"+(10+5));
  System.out.println("Difference :"+(10-5));
  System.out.println("Product :"+(10*5));
}
}

Output

Sum :15                                                                                                                       

Difference :5                                                                                                                 

Product :50     

Add a comment
Know the answer?
Add Answer to:
Java program: Print the sum, difference, and product of 2 numbers without using variables.
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Please create a Java Program, Using Netbeans JDK, that Asks the operator for 2 numbers, and...

    Please create a Java Program, Using Netbeans JDK, that Asks the operator for 2 numbers, and the user's First and Last Name, and calculates the sum, difference, quotient, and product of the 2 numbers. The program should display to screen: "Hello ";{First Name Last Name} "The Sum is ": {Sum} "The Difference is ": {Difference} "The Product is: ": {Product} "The Quotient is ": {Quotient} Each student should post a Java program should have: (a) Pseudocode and (b) adjacent Java...

  • Create a program in Java with the following requirements: Using a Scanner and print statements, ask...

    Create a program in Java with the following requirements: Using a Scanner and print statements, ask the user to input 3 numbers. Use Java’s int data type…don’t worry about error checking for this assignment (assume the user doesn’t try to break your program) Store these three numbers into three variables Calculate the sum of all three numbers Calculate the product of all three numbers If all three numbers are even, output “Lucky Duck!” If all three numbers are odd, output...

  • write a program in java to print all the powers of 2 below a certain number...

    write a program in java to print all the powers of 2 below a certain number and calculate their sum. Make sure your program conforms to the following requirements. 1. Accept the upper limit from the user (as an integer). 2. These numbers grow very fast. make sure the sum variable is of the "long" type. You can assume that the test output will be less that LONG MAX. 3.Print all numbers as a running sum, and finally print their...

  • I need a java program that print the first and last numbers from 12 to 19...

    I need a java program that print the first and last numbers from 12 to 19 using Keyboard

  • write a program to print the largest of any three distinct numbers? ( in java)

    write a program to print the largest of any three distinct numbers? ( in java)

  • Write a java program to print all the powers of 2 below a certain number and...

    Write a java program to print all the powers of 2 below a certain number and calculate their sum Requirements: 1. Accept the upper limit from the user as an integer 2. Make sure the sum variable is of the “long” type. You can assume that the test output will be less than LONG MAX. 3. Print all the numbers as a running sum, and finally print their sum. Please try and restrict yourself to loops, selection statements, and calls...

  • java for netbeans Question 2: (Print distinct numbers) Write a program that reads in ten numbers...

    java for netbeans Question 2: (Print distinct numbers) Write a program that reads in ten numbers and displays the number of distinct numbers and the distinct numbers separated by exactly one space (i.e., if a number appears multiple times, it is displayed only once). (Hint: Read a number and store it to an array if it is new. If the number is already in the array, ignore it. After the input, the array contains the distinct numbers. Here is the...

  • Ask the user for 2 numbers in Python Output the sum, product, quotient and difference of...

    Ask the user for 2 numbers in Python Output the sum, product, quotient and difference of the numbers in Python

  • Write a java program to prompt the user to enter three doubles and compute the sum...

    Write a java program to prompt the user to enter three doubles and compute the sum and product. Print "The sum is 999 and the product is 999.", where 999 is replaced with the user sum and product.

  • write the C++ program to do the following 1. read in 2 numbers as ints 2....

    write the C++ program to do the following 1. read in 2 numbers as ints 2. calculate the sum, difference, product, and quotient 3. print out the four calculated numbers in the following       format           the two input numbers are ??? and ???              sum is             ????              difference is     ????              product is        ????              quotient is       ?????.?????? where ??? represents the ints and ????.???? represents the decimals. You can have any number of decimal places Example: Assume...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT