Program: Loan Eligibility Using Logical AND (&&) Operator

Explanation: This program accepts the salary and age of an applicant. If the salary is greater than 25000 and the age is greater than 25, then the loan is approved. Otherwise, the loan is rejected.


#include <stdio.h>
#include <conio.h>

main()
{
    int s,a;

    clrscr();

    printf("Enter Salary : ");
    scanf("%d",&s);

    printf("Enter Age : ");
    scanf("%d",&a);

    if(s > 25000 && a > 25)
    {
        printf("\nLoan of 500000 is Granted");
    }
    else
    {
        printf("\nLoan of 500000 is Rejected");
    }

    getch();
}

Output:

Enter Salary : 35000
Enter Age : 28

Loan of 500000 is Granted

Practice Exercises

Task 1: Write a C program to accept the age and percentage of a student. If the student's age is 18 or above and the percentage is 60 or above, display "Eligible for Scholarship"; otherwise, display "Not Eligible for Scholarship".

Goal: Learn how to use the Logical AND (&&) operator with the if-else statement.
💡 Hint: Use the condition age >= 18 && percentage >= 60.
💡 Show Solution

#include <stdio.h>
#include <conio.h>

main()
{
    int age,percentage;

    clrscr();

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

    printf("Enter Percentage : ");
    scanf("%d",&percentage);

    if(age >= 18 && percentage >= 60)
    {
        printf("\nEligible for Scholarship");
    }
    else
    {
        printf("\nNot Eligible for Scholarship");
    }

    getch();
}

Output
Enter Age : 20
Enter Percentage : 75

Eligible for Scholarship
Explanation: The program accepts the student's age and percentage. Using the Logical AND (&&) operator, it checks whether both conditions are true. If the age is 18 or above and the percentage is 60 or above, the student is eligible for a scholarship; otherwise, the student is not eligible.