Program to read two numbers and find the largest ( write input and output also)
Answers
Answered by
5
Answer:
a = int(input("1st number: "))
b = int(input("2nd number: "))
if(a > b):
print(a, "is >")
else:
print(b, "is >")
Explanation:
a=50
b=60
op:b is >
Answered by
3
Required Answer:-
Question:
- Write a program to read two numbers and find the largest number.
Solution:
This is written in Python.
1. Without using function.
a=int(input("Enter first number: "))
b=int(input("Enter second number: "))
max=b
if a>b:
max=a
print("Largest number: ",max)
2. Using function.
a=int(input("Enter first number: "))
b=int(input("Enter second number: "))
print("Largest number: ",max(a,b))
3. One line códe for this question:
print("Largest number: ",max(int(input("Enter First Number: ")),int(input("Enter Second Number: "))))
Algorithm:
- START
- Accept two numbers.
- Find the largest of two numbers by comparing their values.
- Display the largest number.
- STOP.
See the attachment for output ☑.
Attachments:
Similar questions