Solution for Exercise 13-4

ex1304

#include <stdio.h>
#include <ctype.h>

int main()
{
    char answer;

    printf("Would you like to blow up the moon? ");
    scanf("%c",&answer);
    answer = toupper(answer);
    if(answer=='Y')
        puts("BOOM!");
    else
        puts("The moon is safe");
    return(0);
}

Output

Would you like to blow up the moon? y
BOOM!

Notes

* Admit it: You typed Y as well!