Solution for Exercise 10-8
ex1008
#include <stdio.h>
void graph(int count,char ch);
int main()
{
int value;
value = 2;
while(value<=64)
{
graph(value,'=');
printf("Value is %d\n",value);
value = value * 2;
}
return(0);
}
void graph(int count,char ch)
{
int x;
for(x=0;x<count;x=x+1)
putchar(ch);
putchar('\n');
}
Notes
* If you make a mistake, it's probably that you forgot to modify the graph() statement in Line 13, which now requires two arguments.
* You may have also forgotten to re-prototype the graph() function. Oops.
* You get For Dummies bonus credits if you use the same variable name as I did in the graph() function, as well as the same character in Line 13.
Copyright © 1997-2025 by QPBC.
All rights reserved
