a program in q Basic to accept two numbers and display the largest of the two numbers
Answers
Answered by
0
Program for the above question in QBaic is as follows:
Explanation:
INPUT "Enter the value for the first number";first_number 'Take the value for the first number.
INPUT "Enter the value for the second number";second_number 'Take the value for the second number.
IF first_number > second_number THEN 'check the condition to grator number.
PRINT first_number 'print if the first number is a greator number.
ELSE
PRINT second_number 'print if the second number is greator number.
END IF
Output:
- If the user gives the input as 4 and 5, then the output is 5.
- If the user gives the input as 6 and 2, then the ouput is 6.
Code Explantion:
- The above code is in Q-Basic, in which the first and the second line is used to render a message to the user and take the input from the user.
- Then the if-condition is used to compare the value that is greater and smallest.
- Then the print statement prints the greater value.
Learn More:
- Q-Basic: https://brainly.in/question/4169343
Similar questions
English,
5 months ago
Geography,
5 months ago
English,
5 months ago
Social Sciences,
10 months ago
History,
10 months ago