MAX1


The source code for max1.c may be downloaded. The purpose of this program is to a conditional branch using the C "if" statement. The program compares two values, a,b and prints out the largest of the two values.


You type> cat max1.c
main()
{
        int a,b, maximum;
        a=1;
        b=10;
        maximum = a;
        if (maximum < b) {maximum=b;}
        printf("maximum = %d\n",maximum);
}
you type> cc -o max1 max1.c
you type> max1
maximum = 10


BACK to index page.