0

I made program take number from user then display the factorial of this number >>>> The program works well but if I enter 20 it crashes. I need help how to accept big number in my program ??????
This my program

#include<iostream>
using namespace std ; 
long long Fact(long long Num)
{
	string Number ;
	if(Num==1)
		return Num ; 
	return Num*Fact(Num-1) ;
}
int main()
{
	long long n,Num ; 
	cin>>Num ; 
	Num=Fact(Num) ;
	cout<<Num<<endl;
	return 0 ;
}

Thanks in advance :)

4
Contributors
4
Replies
5
Views
8 Years
Discussion Span
Last Post by siddhant3s
0

Look up some information about BigNums.
An integer or long integer can only hold a vast amount of bits.

0

How to get information about big nums can you help me with searching...
thanks in advance ...

0

Do you know that 70! is a number with ~100 digits, 450! has more than 1000 digits and so on...
Are you sure that anybody thirsts for reading these huge numbers printed on console?..
Apropos, what for string Number was declared in Fact function?..

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.