Hits: 23 (R Example for Citizen Data Scientist & Business Analyst) Sum of Natural Numbers Using Recursion In this example, you’ll learn to find the sum of natural numbers using recursion. To solve this problem, a recursive function calculate_sum() function is created. Example: Sum of Natural Numbers # Program to find the sum …

# Day: February 5, 2021

Hits: 9 (R Example for Citizen Data Scientist & Business Analyst) R Program to Make a Simple Calculator In this example, you will learn to create a simple calculator that can add, subtract, multiply and divide two numbers entered by the user. Example: Simple Calculator in R # Program make a simple calculator …

Hits: 11 (R Example for Citizen Data Scientist & Business Analyst) R Program to Find L.C.M. In this example, you will learn to find the L.C.M of two numbers entered by the user by creating a user-defined function. The least common multiple (L.C.M.) of two numbers is the smallest positive integer that is perfectly …

Hits: 9 (R Example for Citizen Data Scientist & Business Analyst) R Program to Find H.C.F. or G.C.D In this article, you will learn to find the GCD (Greatest Common Divisor) by creating a user-defined function in two different ways. The highest common factor (H.C.F) or greatest common divisor (G.C.D) of two numbers is …

Hits: 15 (R Example for Citizen Data Scientist & Business Analyst) Fibonacci Sequence Using Recursion in R In this article, you find learn to print the fibonacci sequence by creating a recursive function, recurse_fibonacci(). The first two terms of the Fibonacci sequence is 0 followed by 1. All other terms are obtained by adding …

Hits: 2 (R Example for Citizen Data Scientist & Business Analyst) R Program to Find the Factors of a Number In this example, you’ll learn to find all factors of an number (entered by the user) using for loop and if statement. Example: Find factors of a number print_factors <- function(x) { print(paste(“The factors …

Hits: 21 (R Example for Citizen Data Scientist & Business Analyst) R Program to Find the Factorial of a Number Using Recursion In this example, you’ll learn to find the factorial of a number using a recursive function. The factorial of a number is the product of all the integers from 1 to …

Hits: 7 (R Example for Citizen Data Scientist & Business Analyst) Convert Decimal into Binary using Recursion in R In this example, you will learn to convert decimal number into binary by creating a recursive function, convert_to_binary(). Example: Binary to Decimal # Program to convert decimal number into binary number using recursive function …

Hits: 4 (R Example for Citizen Data Scientist & Business Analyst) R Program to Find the Sum of Natural Numbers In this example, you’ll learn to find the sum of natural numbers entered by the user. The example uses a while loop to calculate the sum. Example 1: Find sum of natural numbers …

Hits: 0 (R Example for Citizen Data Scientist & Business Analyst) Check if a Number is Positive, Negative or Zero In this example, a number entered by the user is checked whether it’s a positive number or a negative number or zero. Example: Check Positive, Negative or Zero # In this program, we …

Hits: 4 (R Example for Citizen Data Scientist & Business Analyst) Check if a Number is Odd or Even in R Programming In this example, a number entered by the user is checked whether it’s an odd number or an even number. Example: Check Odd and Even Number # Program to check if …

Hits: 14 (R Example for Citizen Data Scientist & Business Analyst) R Program to Check for Leap Year This program checks whether an year (integer) entered by the user is a leap year or not. A leap year is exactly divisible by 4 except for century years (years ending with 00). The century year …

Hits: 7 (R Example for Citizen Data Scientist & Business Analyst) R Program to Print the Fibonacci Sequence In this example, you’ll learn to print the Fibonacci sequence using a while loop. A Fibonacci sequence is the integer sequence of 0, 1, 1, 2, 3, 5, 8…. The first two terms are 0 and …

Hits: 15 (R Example for Citizen Data Scientist & Business Analyst) R Program to check Armstrong Number In this example, you’ll learn to check whether a number is an Armstrong number or not using a while loop. An Armstrong number, also known as narcissistic number, is a number that is equal to the …

Hits: 9 (R Example for Citizen Data Scientist & Business Analyst) R Program to Check Prime Number Example to check whether an integer (entered by the user) is a prime number or not using control statements. A positive integer greater than 1 which has no other factors except 1 and the number itself …

Hits: 1 (R Example for Citizen Data Scientist & Business Analyst) R Multiplication Table In this example, you will learn to print the multiplication table of a number (entered by the user) from 1 to 10. Example: Multiplication Table # R Program to find the multiplicationtable (from 1 to 10) # take input …