- Submitted By: raosen
- Date Submitted: 04/15/2013 11:57 AM
- Category: Technology
- Words: 719
- Page: 3
- Views: 229

Introduction to Computer and Programming

Lab Exercise [06 March, 2012] Write all programs, compile them and execute them to check they are working properly. I will come to each student to check each program, take a viva and mark your lab exercise. It is not an exam; you can open your notes to solve these programs but make sure that you understand each and every statement.

P [1] If the ages of three students are input through the keyboard, write a program to determine the youngest of the three. P [2] 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. P [3] Given the length and breadth of a rectangle, write a program to find whether the area of the rectangle is greater than its perimeter. For example, the area of the rectangle with length = 5 and breadth = 4 is greater than its perimeter. Perimeter of rectangle = 2* (length + breadth) Area of rectangle = length * breadth P [4] An Insurance company follows following rules to calculate premium. 1. If a person’s health is excellent and the person is between 25 and 35 years of age and lives in a city and is a male then the premium is Rs. 4 per thousand and his policy amount cannot exceed Rs. 2 lakhs. 2. If a person satisfies all the above conditions except that the sex is female then the premium is Rs. 3 per thousand and her policy amount cannot exceed Rs. 1 lakh. 3. If a person’s health is poor and the person is between 25 and 35 years of age and lives in a village and is a male then the premium is Rs. 6 per thousand and his policy cannot exceed Rs. 10,000. 4. In all other cases the person is not insured. Write a program to output whether the person should be insured or not, his/her premium rate and maximum amount for which he/she can be insured. P [5] A library charges a fine for every book returned late. For first 5 days the fine is 50 paise, for 6-10...