SICP Saga – 0

Downloaded video lectures. Installed the latest MIT Scheme interpreter. Bookmarked the free online copy of SICP. The agenda is to post my notes and insights as I work through the text and video lectures as well as my solutions to the exercises and assignments listed on the site. Let’s have some fun! 😉

Advertisements
SICP Saga – 0

Took me almost too long to get this ‘un

This was a ‘puzzle’ mailed by a friend today. It almost made me realize that I’m getting a bit rusty 😀

Fill in the lines of xxxxxxxxx  so that this program will print  Bingo.  
PS: dont Use printf("bingo")  and return 0 

 

int main()
{
        int a,b;
   

       xxxxxxxxx          

       xxxxxxxxx  

       xxxxxxxxx  

 

        if ( a==b)
                printf("equal");
        else
                if ( a > b )
                        printf("greater");
                else
                        if( a < b)
                                printf("less");
                        else
                                printf("Bingo");

 

        return 0;
}



My solution:


int main()
{
        int a,b;
 
        if (a = b)
                printf("Bingo\n");
        else
 
        if ( a==b)
                printf("equal");
        else
                if ( a > b )
                        printf("greater");
                else
                        if( a < b)
                                printf("less");
                        else
                                printf("Bingo");
 
 
 
        return 0;
}

 
;-)

Bejasus!

Took me almost too long to get this ‘un