Programs in R - using control statements - Assignment 2
Program List
1.Read a mark ( out of 100) and print the corresponding grade.Percentage Range Grade
>=90 O
>=85 and <90 A+
>= 80 and <85 A
> =70 and <80 B+
> =60 and <70 B
> =50 and <60 C
>=45 and <50 P
<45 F
2.Write a program to check the quadrant of a given point(x,y)
3.Write a program that accepts the length of three sides of a triangle as input and determine whether or not the triangle is a right triangle.( university question)
4.Given three points (x1,y1 ) ,(x2,y2) and (x3,y3), check whether they form a triangle.
5.Generate the series 1 2 4 7 11 16....n ( use while...read n)6.Generate the Fibonacci series 0 1 1 2 3 5 8…..n ( use while..read n)
7.Check whether the given 3 digit number is an Armstrong number. (use while Eg:153,370,371,407)
8.Find the factors of a number ( use for)
9.Find the GCD or HCF of two numbers ( use Euclid algorithm and repeat loop)
10.Check whether the given number is a Krishnamurti number( Krishnamurthy Number: It is a number which is equal to the sum of the factorials of all its digits.Use factorial() function from math
For example : 145 = 1! + 4! + 5! = 1 + 24 + 120 = 145
For example : 145 = 1! + 4! + 5! = 1 + 24 + 120 = 145
11.Print prime numbers less than 1000
12.Write a program that computes an investment report.
The inputs to this program are the following:
An initial amount to be invested (a floating-point number)
A period of years (an integer)
An interest rate (a percentage expressed as an integer)
Enter the investment amount: 10000.00
Enter the number of years: 5
Enter the rate as a %: 5
Year Startinbalance Interest Ending balance
1 10000.00 500.00 10500.00
2 10500.00 525.00 11025.00
3 11025.00 551.25 11576.25
4 11576.25 578.81 12155.06
5 12155.06 607.75 12762.82
Ending balance: 12762.82
Total interest earned: 2762.82
The inputs to this program are the following:
An initial amount to be invested (a floating-point number)
A period of years (an integer)
An interest rate (a percentage expressed as an integer)
Enter the investment amount: 10000.00
Enter the number of years: 5
Enter the rate as a %: 5
Year Startinbalance Interest Ending balance
1 10000.00 500.00 10500.00
2 10500.00 525.00 11025.00
3 11025.00 551.25 11576.25
4 11576.25 578.81 12155.06
5 12155.06 607.75 12762.82
Ending balance: 12762.82
Total interest earned: 2762.82
Comments
Post a Comment