Home

A program to explain COMPOUND IF

C Programming Language 016

The following code shows how to write a program to explain COMPOUND IF

Program

#include <stdio.h>

void main()
{
    int a;
    printf("Enter a no.: ");
    scanf("%d", &a);

    if (a % 2 == 0)
    {
        printf("%d is even", a);
    }
    else
    {
        printf("%d is odd", a);
    }

    printf("\n");
}

Result

Enter a no.: 7
7 is odd


Last Updated on

Next Post: Rules vs Guidelines →

Comments