Solution for Exercise 11-9

ex1109

#include <stdio.h>

int main()
{
    float alpha;

    alpha=501;
    printf("alpha = %.1f\n",alpha);
    alpha+=99;
    printf("alpha = %.1f\n",alpha);
    alpha-=250;
    printf("alpha = %.1f\n",alpha);
    alpha/=82;
    printf("alpha = %.1f\n",alpha);
    alpha*=4.3;
    printf("alpha = %.1f\n",alpha);
    return(0);
}

Notes

* Here is the sample output:

* As with an example from Chapter 10, the %.1f conversion character is used in the printf() statements. That conversion character formats output so that it's not peppered with zeros. Chapter 13 discusses the printf() function's conversion characters and their options.