Assignment 2: Decision making and loop control structures
1. 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%
Answer :
3. Write a R program to accept character from the user and check whether the character is a vowel or consonant.
4. 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.
Answer :
2. Write a program to calculate sum of digits of a given input number.
3. Write program to check whether a input number is Armstrong number or not.
4. Write a program to check whether a input number is perfect number of not.
5. Write a R script to display multiplication table of a given input number.
SET B:
1. Write a R program to get all prime numbers up to a given number.
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.
3. Accept the x and y coordinate of a point and find the quadrant in which the point lies.
4. Write a program to check whether a input number is palindrome or not.
5. Write a program to accept a number and count number of even, odd, zero digits within that number.
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
Reviewed by technical_saurabh
on
February 23, 2021
Rating:
1 comment:
Set c answers not give
Post a Comment