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 1lets m=40 2asks the user for two ages 3increases m bythe firstageonly if thesecond is lower thanthe first 4displays m?

Update:

Write a program that:

(1) lets m = 40

(2) asks the user for two ages

(3) increases m by the first age only if the second is lower than the first

(4) displays m

Update 2:

C program

1 Answer

Relevance
  • 7 months ago

    You didn't state which programming language you're learning :(

    Here's a solution written in Python:

    m = 40

    age1 = int (input ("Enter first age: "))

    age2 = int (input ("Enter second age: "))

    if age2 < age1:

        m += age1

    print (m)

Still have questions? Get your answers by asking now.