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);
}

Output

6566676869707172737475767778798081828384858687888990

Notes

* If you didn't like the output when you directly replace %c with %d, consider adding a space after the %d in the printf() statement: printf("%d ",alphabet);

The output then looks like this:

* The program prints the ASCII code values for letters A through Z.