Skip to content
Home » Check Eligibility for Marriage in C

Check Eligibility for Marriage in C

Learn about Check Eligibility for Marriage in C in the below code example. Also refer the comments in the code snippet to get a detailed view about what’s actually happening.

Check Eligibility for Marriage in C

Program:

 #include<stdio.h>
 int main()
 {
   int age;
   char gen;

   printf("Enter Gender: ");
   scanf("%c",&gen);
   printf("Enter Age: ");
   scanf("%d",&age);

   if(gen=='M'||gen=='m'||gen=='F'||gen=='f')
   {
     if( age>=21 || (gen=='F'|| gen=='f') && age>=18)
     printf("Eligible");
     else printf("Not Eligible");
   }
   else printf("Invalid Gender");

   return 0;
 }

Output:

Enter Gender: M
Enter Age: 21
Eligible

Hope above code works for you and Refer the below Related Codes to gain more insights. Happy coding and come back again.

Similar Codes :
Calculate the Net Amount using if else Program in C
Check Character is an Alphabet or not using if else program in C