×

# Why my solution to problem is flagged wrong?

 0 #include long factorial(int num); int main() { int t; scanf("%d", &t); while(t--) { int num; scanf("%d", &num); printf("%d\n", factorial(num)); } return 0; } long factorial(int num) { if(num == 0) return 1; else return (num * factorial(num - 1)); }  So this is my solution to small factorial problem, when I tested it locally it gives the desired output but when I submit this it flags it as wrong one. Can someone let me know why it is wrong? https://www.codechef.com/problems/FCTRL2 asked 17 Oct '18, 23:46 1 accept rate: 0%

 0 Try something like factorial(100). You need a function to handle such big numbers. Another practice for you :) answered 18 Oct '18, 00:54 4★tieros 73●4 accept rate: 12%
 toggle preview community wiki:
Preview

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported
• mathemetical formulas in Latex between \$ symbol

Question tags:

×678
×196
×33

question asked: 17 Oct '18, 23:46

question was seen: 98 times

last updated: 18 Oct '18, 00:54