Thursday, July 17, 2008

Trying operator of equation and relationship operator

Guide:

  1. Use steps program II, but using Project_name which differing, for example Third Program

  2. Change block program function play with following:

    int num1; /* first number to be read from user */
    int num2; /* second number to be read from user */

    printf( "Enter two integers, and I will tell you\n" );
    printf( "the relationships they satisfy: " );

    scanf( "%d%d", &num1, &num2 ); /* read two integers */


    if ( num1 == num2 ) {
    printf( "%d is equal to %d\n", num1, num2 );
    } /* end if */

    if ( num1 != num2 ) {
    printf( "%d is not equal to %d\n", num1, num2 );
    } /* end if */

    if ( num1 < num2 ) {
    printf( "%d is less than %d\n", num1, num2 );
    } /* end if */

    if ( num1 > num2 ) {
    printf( "%d is greater than %d\n", num1, num2 );
    } /* end if */

    if ( num1 <= num2 ) {
    printf( "%d is less than or equal to %d\n", num1, num2 );
    } /* end if */

    if ( num1 >= num2 ) {
    printf( "%d is greater than or equal to %d\n", num1, num2 );
    } /* end if */

    return 0; /* indicate that program ended successfully */

No comments: