Ask Question
24 August, 11:16

Get three int values from the keyboard. Using the conditional operator determine if the numbers are in ascending order. If they are in ascending order store the character 'A' in a char variable otherwise store a 'D' character in the char variable. Do not duplicate assignment operations.

+5
Answers (1)
  1. 24 August, 11:32
    0
    Program:

    First_number = int (input ("Enter first number")) # The first number is entered by the user.

    second_number = int (input ("Enter second number")) # The second number is entered by the user.

    third_number = int (input ("Enter Third number")) # The Third number is entered by the user.

    if (First_number
    store = 'A' # assign the 'A' value on store variable.

    else:

    store = 'D' # Assign the D value on store variable.

    Output:

    If the user inputs 4,5,6 then store variable holds 'A'. If the user inputs 6,5,4 then store variable holds 'D'.

    Explanation:

    The above program is written in python language in which the first, second and the third line of the program is used to rendering the message to the user and take the inputs from the user and stored the value on First_number, second_number, and third_number after converting the value on int. Then the fourth line of the program is used to compare that the first number and second number are in ascending order or not and it also checks that the second number and third number are in ascending order or not. Then assign the 'A' character for the store variable if both the condition is true because it is separated by 'and' operator which gives true if both the condition is true. Otherwise, assign the 'D' character on the store variable.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Get three int values from the keyboard. Using the conditional operator determine if the numbers are in ascending order. If they are in ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers