Computer Science, asked by rgs012070, 1 month ago

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

Answers

Answered by adwaitrane26
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 anindyaadhikari13
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:

  1. START
  2. Accept two numbers.
  3. Find the largest of two numbers by comparing their values.
  4. Display the largest number.
  5. STOP.

See the attachment for output ☑.

Attachments:
Similar questions