0% found this document useful (0 votes)
9 views3 pages

R Programming Sample Exercises

The document provides a series of sample R programming exercises, including tasks such as determining if a number is odd, reversing a number, and printing the Fibonacci series. It also includes additional exercises for calculating the area of a circle, converting temperatures, finding factorials, checking for prime numbers, and identifying palindromes. The document emphasizes the use of '<-' for variable assignment in R.

Uploaded by

star.rana.100
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views3 pages

R Programming Sample Exercises

The document provides a series of sample R programming exercises, including tasks such as determining if a number is odd, reversing a number, and printing the Fibonacci series. It also includes additional exercises for calculating the area of a circle, converting temperatures, finding factorials, checking for prime numbers, and identifying palindromes. The document emphasizes the use of '<-' for variable assignment in R.

Uploaded by

star.rana.100
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Sample R Programs

NOTE - Do not copy the whole code when you are taking input from the
user. Execute that line in which you are taking value from the user. Then
you can paste the remaining code in the R GUI editor.

1) WAP in R to find whether a given number is odd or not.

2) WAP in R to reverse a given number.


3) WAP in R to print the fibonacci series up to n

NOTE: To assign a value to a variable we can use ‘=’ instead of


‘<-’. But ‘=’ is not allowed everywhere. That is why it is better to
use ‘<-’ instead of ‘=’.
Exercise

1) WAP in R to find the area of the circle where ‘r’ is given by the
user.

2) WAP in R to convert a given temperature from celsius to fahrenheit


and vice-versa.

3) WAP in R to find the factorial of a given number.

4) WAP in R to check whether a number is prime or not.

5) WAP in R to check whether a number is palindrome or not.

6) Print the following pattern

*
**
***
****
*****

*****
****
***
**
*

*
***
*****
*******
*********

You might also like