Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

Write a program that prompts the user for two integers and then prints the sum, difference, product, average,?

Write a program that prompts the user for two integers and then prints the sum, difference, product, average, distance, maximum, and minimum.

Update:

C

Update 2:

C plus plus

Update 3:

Distance(absolute value of the difference)

Maximum (the largest of the two)

Minimum (The smallest of the two)

2 Answers

Relevance
  • Anonymous
    7 years ago
    Favorite Answer

    Everyone, I'm not trying to be mean, but PLEASE try and do your own programming instead of always asking for help on basic programs? I've answered some other questions in the past too, but we are really hurting you more than helping. If you are serious about learning to program, realize that you will NEVER learn to be a proficient programmer if you keep asking others to do your work for you. This is such a basic program that anyone should be able to figure it out if they have been listening in class and doing their homework.

    Source(s): years of programming experience
  • 7 years ago

    I don't know how to do it in C++ but this is how to do it in visual basic if it helps.

    This will only work for the sum, difference, product and average as I don't know what you mean by the distance, maximum, and minimum.

    1) Make two text boxes

    Name one "txtNumber1"

    Name the other "txtNumber2"

    2) Make a button and call it "btnCalculate"

    3) Make 4 labels. name them txtlabel1, txtlabel2, txtlabel3 and txtlabel4

    label1 will display the sum

    label2 will display the difference

    label3 will display the product

    label4 will display the average

    4) Double click on the button and type the following code:

    txtlabel1.text = "Sum:"+(txtNumber1.text+txtNumber2

    .text)

    txtlabel2.text = "Difference:"+(txtNumber1.text-txt

    Number2.text)

    txtlabel3.text = "Product:"+(txtNumber1.text*txtNumber2

    .text)

    txtlabel1.text = "Average:"+((txtNumber1.text+txtNumber2

    .text)/2)

    I Hope this helped. To add the distance, maximum and minimum just do the same sort of thing but change the symbols in the math part and add more labels.

Still have questions? Get your answers by asking now.