Program to check eligibility for marriage
#include<stdio.h>
void main()
{
int age;
char gender;
printf("Enter Your Gender Male(M) or
Female(F): ");
scanf("%c",&gender);
printf("Enter your age: ");
scanf("%d",&age);
if (age>=18&&gender =='F')
{
printf("Eligible for
marriage!!!");
}
else if(age>=21&&gender =='M')
{
printf("Eligible for
marriage!!!");
}
else
{
printf("Not eligible for marriage!!!");
}
}
Output:
In above screenshot we see that it is not eligible for marriage it is because
|
Explanation:
We know that for marriage eligibility for female is age more than 18 years and for male is age more than 21 years.
We have checked same conditions using if...else if...else statements.
We know that for marriage eligibility for female is age more than 18 years and for male is age more than 21 years.
We have checked same conditions using if...else if...else statements.
No comments:
Post a Comment