I'm wondering how you managed to get this far when the basic mechanics of writing C are beyond you.
Code:
#include <stdio.h>
#include <conio.h>
#include <ctype.h>
#include <math.h>
/*!! why exactly are you returning a double here? */
double Hanoi(int numdisks, int start, int goal, int temp);
/*!! always say main returns int */
int main()
{
int num, steps, start, temp, goal, numdisks;
start = 1;
temp = 2;
goal = 3;
printf(" Welcome T0 Kavi'S Towers Of Hanoi\n");
printf("\nEnter a number to calculate the steps for the Towers Of Hanoi: ");
scanf("%d", &num);
while (num < 1 || num > 15) {
/*!! your instructions and code do not agree */
printf("Factorials Have to be above 0 and under 12 Re Enter Value: ");
scanf("%d", &num);
}
steps = pow(2, num) - 1;
num = numdisks;/*!! missing ; */
printf("\n Number of steps is: %i ", steps);
/*!! 1. This printf() is missing a closing ) */
/*!! 2. The number of parameters does not match the number of conversions */
/*!! 3. The types are wrong - you said Hanoi() returns a double */
printf("\n Move Disk from Peg %i to Peg %i",
Hanoi(numdisks, start, goal, temp);
/*!! we already said this was bad, you still use it */
fflush(stdin);
getch();
return 0;
}
{ /*!! what is this brace doing here? */
/*!! why have to dropped back to implicitly declaring the return type? */
Hanoi(numrings, start, goal, temp); /*!! where is the { ? */
if (numrings = 1); /*!! use == for comparison, and drop the ; */
/*!! you already used printf successfully above, this isn't good at all */
printf("move a disk from " start " to " goal ");
else;/*!! more stray ; and no {} */
Hanoi (numrings-1, start, temp, goal);
Hanoi (numrings 1, start, goal, temp); /*!! maybe -1 ? */
Hanoi (numrings-1, temp, goal, start);
}
Lots of comments - follow the !!