Hello ,this is my first post here,so please excuse me if i broke any rules, or i posted in a wrong section.

I have this homework for school:we have to come up with a program that transforms a number in radix a to a number in radix b.

Ive come up with this so far:

Code:

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
char number[50];
int radix;
int i;
int result;
int max=strlen(number);
int test=0;
int c=max-1;
printf("Insert the number you want to transform\n");
scanf("\n%s",number);
printf("\nInsert its radix\n");
scanf("\n%d",&radix);
printf("\nmax=%d",max);
test=pow(radix,c);
printf("\n%d",test);
for(i=0;i<max;i++){
result=result+(number[i]*(pow(radix,c)));
c--;}
printf("\nresult=%d",result);
}

The problem is, the pow(a,b) function doesnt seem to work right.Ive even tried to define my own function but that didnt work either.

So please help me,but keep in mind that im a really newb(this is my first semester in programing),so dont come with really complicate answers.

Thank you in advance!

Mblue