Jumat, 07 November 2025

ex0806.c if(a > b) else()

/* ex0806.c */
#include <stdio.h>

int main()
{
    int a,b;
    a = 6;
    b = a - 2;

    if(a > b)
    {
        printf("%d is greater than %d\n", a,b);
    }
    else
    {
        printf("%d is NOT greater than %d\n", a,b);
    }
    return(0);
}

output:
 
6 is greater than 4

Process returned 0 (0x0)   execution time : 0.093 s
Press any key to continue.

Contoh penggunaan if() & else().

Tidak ada komentar:

Posting Komentar