I have modified the code a bit and have what is below. The number that is output is more realistic now but it still isn't correct (for example, inputting 54# results in an output of 36 when it should put out 44)
#include <stdio.h>
#include <math.h>
main()
{
printf("Please enter an octal number ending with # \n");
int nextNum = getchar();
int number[100];
int numberOfSlots = 0; //Records how many digits are entered
int power = 0; //Sets power of 8 during conversion
int decimalNumber = 0;
int i=0;
while(nextNum != '#') //reads in the whole number, putting the characters together to form one Octal number.
{
if(nextNum >='0' && nextNum <='9')
nextNum = (nextNum - '0');
else{printf("Oops! That's not a valid number!");}
number['i'] = (nextNum);
//numberOfSlots++;
i++;
nextNum = getchar();
printf("%d\n", number['i']);
}
//Begin converson from Octal to Decimal
for(i; i > 0; i--)
{
decimalNumber = decimalNumber + (number['i'] * pow(8,power));
power++;
}
printf("%d", decimalNumber);
}