Pascal's Triangle Program Only Accurate to 12 Rows

Hello, I'm new to programming in C, so I've been working on some of the challenges. I've completed the Pascal's Triangle challenge, however my program doesn't give accurate values past the 12th row of the triangle. I'm wondering if this is a logic error on my part, or maybe a memory problem with my factorial function? Any help is greatly appreciated.

Code:

`#include <stdio.h>`

int factorial( int n )

{

if ( n <= 1 )

return 1;

else

return n * factorial( n - 1 );

}

int main()

{

int n;

int r;

int value = 0;

do {

n = 0;

r = 0;

printf( "Input the row#: " );

scanf( "%d", &n );

printg( "Input the value's position within the row: " );

scanf( "%d", &r );

if ( r > n )

printf( "That is not a valid position within Pascal's Triangle\n" );

} while ( r > n );

value = factorial( n ) / (factorial( r ) * factorial( n - r ));

printf( "The value at row-%d, position-%d is %d\n", n, r, value );

return 0;

}