0

Can some one help me with project greatest number

The project says The given code takes 3 numbers as input. Complete the program to output the maximum of the 3 inputs. And this was my answer: nput <- readLines('stdin') x <- as.integer(input[1]) y <- as.integer(input[2]) rangeSum <- function(x, y) { s=0 for (n in x:y) s <- s + n return (s) } print(rangeSum(x, y)) but as I pressed run it say it's wrong so can you help me please

18th Sep 2021, 1:35 PM
CoMpUtOr/ScIeNtiSt
CoMpUtOr/ScIeNtiSt - avatar
8 ответов
+ 2
what is wrong with this python code to output the Greatest number among three num1 = 9 num2 = 56 num3 = 42 # uncomment following lines to take three numbers from user #num1 = float(input("Enter first number: ")) #num2 = float(input("Enter second number: ")) #num3 = float(input("Enter third number: ")) if (num1 >= num2) and (num1 >= num3): largest = num1 elif (num2 >= num1) and (num2 >= num3): largest = num2: else: largest = num3: print("The largest number is", largest)
15th Feb 2022, 7:07 AM
stephen mazola
stephen mazola - avatar
+ 1
num1 = 9 num2 = 56 num3 = 42 # uncomment following lines to take three numbers from user num1 = float(input("Enter first number: ")) num2 = float(input("Enter second number: ")) num3 = float(input("Enter third number: ")) if (num1 >= num2) and (num1 >= num3): largest = num1 elif (num2 >= num1) and (num2 >= num3): largest = num2: else: largest = num3: print("The largest number is, largest")
26th Jun 2022, 5:57 PM
CoMpUtOr/ScIeNtiSt
CoMpUtOr/ScIeNtiSt - avatar
0
Mistakes 1. That input not nput 2 using s + n you are resulting the sum of input
18th Sep 2021, 1:57 PM
Pariket Thakur
Pariket Thakur - avatar
0
The code doesn't match the question and task description. Which task do you want to do? Please clarify.
18th Sep 2021, 4:52 PM
Lisa
Lisa - avatar
0
#Use this command to learn more about the max() function: help(max)
20th Sep 2021, 5:49 AM
Cmurio
Cmurio - avatar
0
Input <- readLines('stdin') x <- as.integer(input[1]) y <- as.integer(input[2]) rangeSum <- function(x, y) { s=0 for (n in x:y) s <- s + n return (s) } print(rangeSum(x, y)) but as I pressed run it say it's wrong so can you help me please
29th Dec 2021, 7:03 PM
Filip Jevtić
Filip Jevtić - avatar
0
Thx guys B)
26th Jun 2022, 5:55 PM
CoMpUtOr/ScIeNtiSt
CoMpUtOr/ScIeNtiSt - avatar
- 1
U can use max(x,y )
18th Sep 2021, 2:03 PM
Pariket Thakur
Pariket Thakur - avatar