My First Function creation
Posted on 2003-02-22
Given this main body of code, I need to put the calculation part into a seperate function, which i can then call within the main body.
I have tried but get syntax errors so am now at a loss. Many thanks for any help or answers:
* main() function
float total =0.0;
while (number >= 0)
cprintf("\r\nEnter a number between 0 and 10.0\r\n");
cprintf("Or enter a negative number to terminate.\r\n");
number = in_float();
}while (number >10);
while ((total < number) && (kbhit() == 0))
total = total + 1.0/(float)count;
cprintf("\r\nThe number of reciprocals"
" needed was %u\r\n",count);
* end of main()