Dear Friends, When i make a program of factorial in C it runs but it doesn't gives the factorial of big numbers. Like 20 or 50. I read about long int data-type in book, but i am unable to process it. Please help in these regards.
I think you mean long long not long int. long int is equivalent to long I believe. long long will give you a 64-bit integer value, but even this may not be enough to work with larger factorials.
Without a bignum library, you won't be able to do this. C++ just doesn't have the support 'out of the box' for numbers over a certain size. If you're feeling brave, you can code your own. GMP works well, and I'm pretty sure it works with Visual Studio. http://gmplib.org/
Thanks Brian and organicCyborg, I got my answer. Here it is:- void main() { long int a; printf ("Enter the population of India"); scanf("%ld",&a); Thanks all for your support.
long long int is 64 bits. long int is long, thus usually 32 bits. %lld should be fine for printf, but you should really look up the format specifications instead of asking. It's easy.