Click the Follow Button

c ; How to use if-else function

 

// if - else func
#include <stdio.h>

int main()
{
    int x, y;
    printf("Enter x and y: \n");
    scanf("%d %d", &x, &y);

    if (x > y)
    {
        printf("X is greater than y");
    }
    else if (x < y)
    {
       printf("X is lesser than y");
    }
    else if (x == y)
    {
        printf("Both are equal.");
    }
    // or use else
}


Comments

Popular Posts

TIC - TAC - TOE

Prime and not prime number

do_while loop is to do something again and again