In this program, You will learn how to check the age of a user is eligible for voting or not in R.
R Program Example: How to Check Age of a user is eligible for voting or not in R
1 2 3 4 5 6 7 8 9 10 11 12 |
{ age <- as.integer(readline(prompt = "Enter your age :")) if (age >= 18) { print(paste("You are valid for voting :", age)) } else{ print(paste("You are not valid for voting :", age)) } } |
Output:
1 2 3 4 |
Enter your age :48 [1] "You are valid for voting : 48" |