Python Code to find largest of three numbers
Topic: Largest of Three Numbers
Hey Guys, today we are going see a Python Program to find largest of three numbers.
Title: Python Code for finding largest of three numbers(Beginner Friendly+ Easy + Code + Output + Online Compiler)
What is this program and why we are going to use it?
This Program consists of Variables, Input Function, Conditional Statement and Comparison Operator.
By using variable, we are going to store a value in a Variable in int or float format according to our use. By using input function, we are going to input values from the user. For Eg. storing the values:
a=5
here a is variable where 5 is assigned to a.
Now for input fucntion
By using variable, we are going to store a value in a Variable in int or float format according to our use. By using input function, we are going to input values from the user. For Eg. storing the values:
a=5
here a is variable where 5 is assigned to a.
Now for input fucntion
a= int(input("Enter Num a:"))
So, this will ask user to input a number.
Which works as it checks if statement first and if it's true it provides the output/code under if statement and if its false then it provides the output/code under else statement.
Our code first checks a is greater then b or not. If it its it checks whether its greater than c. If it is then it prints a as largest otherwise c as largest. as its larger than a which was initally larger than b.
Similar Logic applies when a is not greater than b it conducts this query at else.
logic:
We are Using Here Conditional Statement "if...else".Which works as it checks if statement first and if it's true it provides the output/code under if statement and if its false then it provides the output/code under else statement.
Our code first checks a is greater then b or not. If it its it checks whether its greater than c. If it is then it prints a as largest otherwise c as largest. as its larger than a which was initally larger than b.
Similar Logic applies when a is not greater than b it conducts this query at else.
b > c
Comments
Post a Comment