Im taking a C programming course in my crappy community college and one of the projects is to:

Write a C function named PowerTable() that will create a table of squares and cubes. The function should accept as parameters the starting number for the table, the number of rows in the table and the increment (always an integer) for each row of the table

The function will output to the screen the following table:

Number Square Cube

-----------------------------

1.5000 2.2500 3.3750

3.5000 12.2500 42.8750

5.5000 30.2500 166.3750

My problem is I can only get the "number" colum to work,

the square and cube all come out as 0.00000.

Ive spent hours trying to figure out what I did wrong, and I can't see it. Any suggestions?

Thanks everyone, you all rock

<Someone just mentioned that my scanf's should be %1f instad of %d's, but when I change it I get even more jibberish...any ideas?>

Code:

#include <stdio.h>
double start;
int rows;
double incr;
/* double for starting number, integer for rows (can't have half a row), double for incriment value
(can incrimint by 1.5 and etc) */
int PowerTable(double, int, double);
void main(void)
{
rows = 0;
printf("How many rows do you wish to have?\n");
scanf("%d", &rows);
printf("What do you wish the starting number for the table to be?\n");
scanf("%d", &start);
printf("How much do you wish each number to be incriminted?\n");
scanf("%d", &incr);
PowerTable(start, rows, incr);
}
PowerTable(double fstart, int frows, double fincr )
{
int timesdone;
double square[500];
double cube[500];
timesdone = 0;
printf("\tNumber \t\t\t Square\t\t\t Cube\n");
printf("\t--------------------------------------------------\n");
while(timesdone <= frows)
{
square[timesdone] = (fstart * fstart);
cube[timesdone] = fstart * fstart * fstart;
printf("\t%d \t\t\t \t %5.2f \t\t\t %5.2f\n", fstart, square[timesdone], cube[timesdone]);
fstart += fincr;
timesdone++;
}
printf("Done\n");
return(0);
}

*Code tags added by Kermi3*