Introduction to Programming

if ... then


#include <stdio.h>

int main(int argc, char *argv[])
{
    int a, b, c;

    a = 1;
    b = 2;
    c = 3;

    if (a > b)
    {
        printf("Can I get here?\n");
    }
    else if (b <= c)
    {
        printf("How about here?\n");
    }
    else
    {
        printf("The last possibility.\n");
    }

    return 0;
}

Next: Loops

Previous: Variables and Expressions


Introduction to Programming

Home