Solution for Exercise 10-7

ex1007

#include <stdio.h>

void graph(int count);

int main()
{
    int value;

    value = 2;

    while(value<=64)
    {
        graph(64);
        printf("Value is %d\n",value);
        value = value * 2;
    }
    return(0);
}

void graph(int count)
{
    int x;

    for(x=0;x<count;x=x+1)
        putchar('*');
    putchar('\n');
}

Notes

* Give yourself some For Dummies bonus points if you created a constant expression by using the #define directive in your solution. (I didn't.)