Nested if Statement in C


It is always legal in C programming to nest if-else statements, which means you can use one if or else if statement inside another if or else if statement(s).

Source Code

// Nested if Finding given year is leap year
 
int main()
{
    int year;
    printf("\nEnter The Year : ");
    scanf("%d",&year);
    if(year%100==0)
    {
        if(year%400==0)
        {
            printf("%d is leap Year",year);
        }
        else
        {
            printf("%d is Not leap Year",year);
        }
    }
    else
    {
        if(year%4==0)
        {
            printf("%d is leap Year",year);
        }
        else
        {
            printf("%d is Not leap Year",year);
        }
 
    }
    return 0;
}
 
To download raw file Click Here

List of Programs


Sample Programs


Switch Case in C


Conditional Operators in C


Goto Statement in C


While Loop Example Programs


Looping Statements in C

For Loop Example Programs


Array Examples in C

One Dimensional Array


Two Dimensional Array in C


String Example Programs in C


Functions Example Programs in C


Learn All in Tamil © Designed & Developed By Tutor Joes