100 days c program challenge
100 Days
of programming challenge
By,
G. Praveen Kumar,
B.Sc. Computer Science.,
Day -1 : Marriage eligible checker program
Program:
#include <stdio.h> int main() { int maleage, femaleage; for (int i = 0; i < 4; i++) { // Loop to ask user 4 times printf("\nAttempt %d:\n", i + 1); // Taking input printf("Enter the Male's age: "); scanf("%d", &maleage); printf("Enter the Female's age: "); scanf("%d", &femaleage); // Checking eligibility if (maleage >= 25 && femaleage >= 21) { printf("Congrats! Both are eligible for marriage.\n"); } else if (maleage < 25 && femaleage >= 21) { printf("Sorry! Male is not eligible for marriage.\n"); } else if (maleage >= 25 && femaleage < 21) { printf("Sorry! Female is not eligible for marriage.\n"); } else { printf("Sorry! Both are not eligible for marriage.\n"); } } return 0; }
Out put :
Attempt 1: Enter the Male's age: 26 Enter the Female's age: 22 Congrats! Both are eligible for marriage. Attempt 2: Enter the Male's age: 23 Enter the Female's age: 22 Sorry! Male is not eligible for marriage. Attempt 3: Enter the Male's age: 27 Enter the Female's age: 20 Sorry! Female is not eligible for marriage. Attempt 4: Enter the Male's age: 22 Enter the Female's age: 18 Sorry! Both are not eligible for marriage.