R Program to Find the greatest number among three numbers


In this program, You will learn how to find the greatest number among the three numbers in R.


Find Greatest Among Three Numbers

Numbers Is :10 20 40 => 40

Numbers Is :30 20 10 => 30

Example: How to find the greatest number among three numbers in R

{
    x <- as.integer(readline(prompt = "Enter first number :"))
    y <- as.integer(readline(prompt = "Enter second number :"))
    z <- as.integer(readline(prompt = "Enter third number :"))

    if (x > y && x > z) {
      print(paste("Greatest is :", x))
    } else if (y > z) {
      print(paste("Greatest is :", y))
    } else{
      print(paste("Greatest is :", z))
    }

}

Output:

Enter first number :2
Enter second number :22
Enter third number :4
[1] "Greatest is : 22"

Xiith is created for educational, experimental, and schooling purpose. Examples on Xiith are made easier to make a better or basic understanding. Tutorials, testimonials, and examples are continuously checked to avoid delusion, but we cannot take complete responsibility of all programs on Xiith. When you are operating this site, you have to agree to read and accept our terms of use, cookie and privacy policy.Copyright © 2020 by Xiith. All Rights Reserved. About us.