Solution for Exercise 9-9

ex0909

#include <stdio.h>

int main()
{
    char alphabet;

    for(alphabet='A';alphabet<='Z';alphabet=alphabet+1)
    {
        printf("%d ",alphabet);
    }
    putchar('\n');
    return(0);
}

Notes

* When you make a direct replacement of %d for %c, the output looks like this:

* In this listing, I add a space after the %d in the printf() statement so that the numeric output looks better:

* The program essentially prints the ASCII codes for letters A through Z.