-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path4.2.c
35 lines (30 loc) · 864 Bytes
/
4.2.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <stdio.h>
int main(int argc, char const *argv[])
{
char marriedQuestion;
char gender;
int age;
printf("Are you married? [y/n]: ");
scanf(" %c", &marriedQuestion);
printf("What is your gender? [m/f]: ");
scanf(" %c", &gender);
printf("Please Enter Your Age: ");
scanf("%d", &age);
if (marriedQuestion=='y')
{
printf("Because you are married, you are insured.");
}
else if(marriedQuestion=='n' && gender=='m' && age>30)
{
printf("You are insured because you are not married, you are male, and your age is above 30");
}
else if(marriedQuestion=='n' && gender=='f' && age > 25)
{
printf("You are insured because you are not married, you are female, and your age is above 25.");
}
else
{
printf("Your are not insured.");
}
return 0;
}