The new solutions will be uploaded there, I will try to come up with Solutions of some other popular programming books.:) Suggestions are always welcome. Let Us C / Chapter 1 (Getting started). Let Us C / Chapter 2 (The Decision Control Structure) Search This Blog. It contains solutions to all the exercises present in Let Us C 15th Edition. If you learn the language elements from Let Us C, write programs for the problems given in the exercises and then cross check your answers with the solutions given in this book you would be well on your way to become a skilled C programmer.


Chapter 2 Completedlet Us C Solutions Pvt Ltd
Question-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.
Solution- Honestly speaking ,these type of questions are really boring. Here is the solution.
#include<stdio.h>
int main()
{
int health,age,gender,residence;
printf('Enter your info. Health(Excellent=1,poor=0),age(25-35=1 ,else=0),gender(Male=1,female=0),residense info.(Rural=1,urban=0)n');
scanf('%d%d%d%d',&health,&age,&gender,&residence);
if(health1&&age1&&gender1&&residence0)
printf(' premium is Rs. 4 per thousand and his policy amount cannot exceed Rs. 2 lakhsn');
else if (health1&&age1&&gender0&&residence0)
printf('premium is Rs. 3 per thousand and her policy amount cannot exceed Rs. 1 lakhn');
else if(health1&&age1&&gender0&&residence1)
printf('premium is Rs. 6 per thousand and his policy cannot exceed Rs. 10,000n');
else
printf('Person can not be insuredn');
return 0;
}
/* We can write all condition together using || but it would difficult to read so i prefer this way */
(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.
Solution- Honestly speaking ,these type of questions are really boring. Here is the solution.
#include<stdio.h>
int main()
{
int health,age,gender,residence;
printf('Enter your info. Health(Excellent=1,poor=0),age(25-35=1 ,else=0),gender(Male=1,female=0),residense info.(Rural=1,urban=0)n');
scanf('%d%d%d%d',&health,&age,&gender,&residence);
if(health1&&age1&&gender1&&residence0)
printf(' premium is Rs. 4 per thousand and his policy amount cannot exceed Rs. 2 lakhsn');
else if (health1&&age1&&gender0&&residence0)
printf('premium is Rs. 3 per thousand and her policy amount cannot exceed Rs. 1 lakhn');
else if(health1&&age1&&gender0&&residence1)
printf('premium is Rs. 6 per thousand and his policy cannot exceed Rs. 10,000n');
else
printf('Person can not be insuredn');
return 0;
}
/* We can write all condition together using || but it would difficult to read so i prefer this way */
