R Programming: Take input from the user and display the values, print the version of R installation
R Programming: Basic Exercise-1 with Solution
Write a R program to take input from the user (name and age) and display the values. Also print the version of R installation.
Sample Solution :
R Programming Code :
name = readline(prompt="Input your name: ")
age = readline(prompt="Input your age: ")
print(paste("My name is",name, "and I am",age ,"years old."))
print(R.version.string)
Sample Output:
Input your name: Input your age: [1] "My name is and I am years old." [1] "R version 3.4.4 (2018-03-15)"
R Programming Code Editor:
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
Previous: R Programming Exercises Home.
Next: Write a R program to get the details of the objects in memory.
Test your Programming skills with w3resource's quiz.
What is the difficulty level of this exercise?
- New Content published on w3resource:
- HTML-CSS Practical: Exercises, Practice, Solution
- Java Regular Expression: Exercises, Practice, Solution
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework