I have a programming assignment for CSCI180. The assignment is to create a recursive function power(base, exponent) that when invoked returns base ^ exponent. Everything compiles correctly and when i run the program i enter the base and exponent like prompted. But then the program stops working and i cannot determine why.
Here is the code i have. help would be greatly appreciated.

#include <stdio.h>

int power(int base,int exponent);

int main( void )
	int choice;
	int base;
	int exponent;
		printf("enter a number and an exponent.\n");
		scanf("%d,%d", &base, &exponent);
		printf("%d raised to the %d is %d.\n", base, exponent, power(base,exponent));

		printf("would you like to enter another power?\n");
		printf("please type (1 = yes, 2 = no)\n");
		scanf("%d", &choice);

	}while ( choice != 2 );

	return 0;

	int power( int base, int exponent)
		if (exponent==1){
			return base;
		else {
			return base * power(base, exponent-1);
               if (exponent < 0)
                        return 1/base * power(base, exponent-1);

Thanks that was my problem. i hate getting all aggravated because of stupid little errors.

This question has already been answered. Start a new discussion instead.