Computer Science, asked by rgs012070, 4 months ago

write python Program to read two numbers and find the largest.
(input and output also)​

Answers

Answered by atrs7391
2

Program:

1. a = int(input("Enter first number: "))

2. b = int(input("Enter second number: "))

3. if a < b:

4.     print(b, "is the largest number")

5. else:

6.    print(a, "is the largest number")

Explanation:

Line 1 and 2 takes the input of two numbers from the user and stores them in the variable a and b respectively and declares the variables as numbers.

Line 3 is a conditional operator (if-else) that checks whether a less than b or not, and if yes, a is less than b then it executes Line 4 which prints that b is the largest number.

If Line 3 is false i.e. a is not less than b then it executes Line 5 which then executes Line 6 and prints that a is the largest number.

Similar questions