Skip to content

Instantly share code, notes, and snippets.

@jagdish4501
Created April 2, 2021 11:19
Show Gist options
  • Save jagdish4501/48099737b24baa0d53cd9d7cecca1e20 to your computer and use it in GitHub Desktop.
Save jagdish4501/48099737b24baa0d53cd9d7cecca1e20 to your computer and use it in GitHub Desktop.
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 …
#include <stdio.h>
int main()
{
int age, health_condition, residance;
char gender;
printf("enter your gender(m,f) :"); // for male 'm' for female 'f'
scanf("%c", &gender);
printf("enter your age :");
scanf("%d", &age);
printf("what is your healt_condition(exc=1 ,bdcon=0):"); //for excellant(1) bad condton (0)
scanf("%d", &health_condition);
printf("enter your residance palce(city=1 ,village=0) :"); // for city (1) for village(0)
scanf("%d", &residance);
if ((health_condition == 1) && (age >= 25 && age <= 35) && (residance == 1) && (gender == 'm'))
{
printf("\npremium is Rs. 4 per thousand and your policy amount cannot exceed Rs. 2 lakhs!!");
}
else if ((health_condition == 1) && (age >= 25 && age <= 35) && (residance == 1) && (gender == 'f'))
{
printf("\npremium is Rs. 3 per thousand and your policy amount cannot exceed Rs. 1 lakhs!!");
}
else if ((health_condition == 0) && (age >= 25 && age <= 35) && (residance == 0) && (gender == 'm'))
{
printf("\npremium is Rs. 6 per thousand and his policy cannot exceed Rs. 10,000!!");
}
else
printf("\nyou willn't be elligible for this premium");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment