+ 2
Program to find largest of three numbers
using If and else
5 ответов
+ 5
a,b,c=1,2,3
if a>b and a>c:
print("A is the Greatest",a)
elif b>a and b>c:
print("B is the Greatest",b)
else:
print("C is the Greatest",c)
+ 5
You can also use the max() function
print(max(1,2,3))
+ 1
elias's method is the best way to go for that buuuuut if you are required for a class or something to use else and if statements do caco's method
0
here is the code.....excellent
input <- readLines('stdin')
x <- as.integer(input[1])
y <- as.integer(input[2])
z <- as.integer(input[3])
res<-max(x,y,z)
print(res)
- 1
a,b,c=123
if(a>b)
print("a is greater ")
else
if(b>c)
print(" b is greater")
else
print("c is greater")