Assignment 1
Assignment 1
CALCULATION
1. Write a program to check whether the given two numbers are equal or not.
2. Write a program to check whether the given year is leap year or not.
3. Write a program to check whether the given number is odd or even.
4. Write a program to find whether the given number is positive or negative.
5. Write a program to find the biggest number among 3 numbers using if else statement.
6. Write a program to sort three numbers using if else statements.
7. Write a program to check whether a triangle is valid or not, when the three angles of
the triangle are entered through the keyboard. A triangle is valid if the sum of all the
three angles is equal to 180 degrees.
8. Write a program to calculate the electricity bill using if else statement.
If a unit consumed is below 100, cost per unit is Rs. 2.50.
If unit consumed is between 100 to 250 cost per unit is Rs. 4.00.
If unit consumed is above 250 cost per unit is Rs 5.00
9. Write a program to calculate the grade of the student, given the mark.
If mark is equal to and above 90, grade is “S”.
If mark is between 80 and 89, grade is “A”(inclusive of both limits).
If mark is between 70 and 79, grade is “B” (inclusive of both limits).
If mark is between 60 and 69, grade is “C” (inclusive of both limits).
If mark is between 50 and 59, grade is “D” (inclusive of both limits).
If mark is below 50, then the grade is “U”.
10. Write a program to find the maximum and minimum number from a given set of
numbers.
11. Write a program to calculate Gross pay and Net pay based on the following condition.
If Basic Pay is > 15000 then HRA is 10% of Basic Pay else 5% of Basic
Pay.
Dearness Pay = 10% of Basic Pay.
Dearness Allowance = 18% of (Basic Pay + Dearness Pay).
CCA = 500, MA = 200, GPF = 20% 0f (Basic Pay + Dearness Pay).
FBF = 10% of (Basic Pay + Dearness Pay), IT = 700.
Gross Pay = Basic Pay + Dearness Pay + Dearness Allowance + HRA + CCA +
MA.
Deductions = GPF + FBF + IT.
Net Pay = Gross Pay – Deductions.
11. Write a program to calculate the roots of quadratic equation.