Decision making and loop control structures | R Programming Solved Assignment

Assignment 2: Decision making and loop control structures

Write a R program to take input from the user (name and age) and display the values. Also print the version of R installation.

1. Write a R program to accept an integer and check if it is even or odd.


Write a R program to accept an integer and check if it is even or odd.


Answer :




2. Write a R program, which accepts annual basic salary of an employee and calculates and displays the Income tax as per the following rules.
Basic: < 1,50,000
Tax = 0
Basic: 1,50,000 to 3,00,000
Tax = 20%
Basic: > 3,00,000 Tax = 30%

Write a R program, which accepts annual basic salary of an employee and calculates and displays the Income tax as per the following rules. Basic: < 1,50,000 Tax = 0 Basic: 1,50,000 to 3,00,000 Tax = 20% Basic: > 3,00,000 Tax = 30%

Answer :



3. Write a R program to accept character from the user and check whether the character is a vowel or consonant.

Write a R program to accept character from the user and check whether the character is a vowel or consonant.

Answer :



4. Write a R program accept any year as input and check whether the year is a leap year or not.

Write a R program accept any year as input and check whether the year is a leap year or not.

Answer :



SET A:


1. Write a R program to display the first 10 Fibonacci numbers.

Write a R program to display the first 10 Fibonacci numbers.

Answer :



2. Write a program to calculate sum of digits of a given input number.

Write a program to calculate sum of digits of a given input number.

Answer :



3. Write program to check whether a input number is Armstrong number or not.

Write program to check whether a input number is Armstrong number or not.

Answer :



4. Write a program to check whether a input number is perfect number of not.

Write a program to check whether a input number is perfect number of not.

Answer :



5. Write a R script to display multiplication table of a given input number.

Write a R script to display multiplication table of a given input number.

Answer :

SET B:


1. Write a R program to get all prime numbers up to a given number.

Write a R program to get all prime numbers up to a given number.

Answer :



2. Accept the cost price and selling price from the keyboard. Find out if the seller has made a profit or loss and display how much profit or loss has been made.


Accept the cost price and selling price from the keyboard. Find out if the seller has made a profit or loss and display how much profit or loss has been made.

Answer :



3. Accept the x and y coordinate of a point and find the quadrant in which the point lies.

Accept the x and y coordinate of a point and find the quadrant in which the point lies.

Answer :



4. Write a program to check whether a input number is palindrome or not.

Write a program to check whether a input number is palindrome or not.

Answer :



5. Write a program to accept a number and count number of even, odd, zero digits within that number.

Write a program to accept a number and count number of even, odd, zero digits within that number.

Answer :



SET C:


1. Use a while loop to simulate one stock price path starting at 100 and random normally distributed percentage jumps with mean 0 and standard deviation of 0.01 each period. How long does it take to reach above 150 or below 50?

Answer :

 

2. Implement a multiplication game. A while loop that gives the user two random numbers from 2 to 12 and asks the user to multiply them without using * operator.

Answer :

 

Decision making and loop control structures | R Programming Solved Assignment Decision making and loop control structures  | R Programming Solved Assignment Reviewed by technical_saurabh on February 23, 2021 Rating: 5

1 comment:

Unknown said...

Set c answers not give

Powered by Blogger.