shivali24: Just think about it for a while. What’s the range of int? Approximately 10^9. What’s the range of long long? Approximately 10^18. How large can the result get? Try a calculator: 30! is around 10^32. Well… shit.
Of course it won’t work with any integer type of C/C++. Try using "bigint"s - represent a number as an array of base-10 digits. (It works a bit faster if you use a larger base.) You just need to implement the addition and multiplication of such numbers, which is easy enough in O(number of digits ^2) in the same way as you’d do it on paper.