![]() |
pls check it for me
there is a exponential program, it has some problem in result {if x=1 and n=5 the answer must be 2.7016}
pls tell me the problem and solution also Code:
#include<stdio.h> |
Re: pls check it for me
Quote:
check the result again.i think it must be 2.7083 i made 2 corrections and also i changed how scanf gets its data. Code:
#include<stdio.h> |
Re: pls check it for me
Quote:
once again thanks |
Re: pls check it for me
a better solution is this
Code:
#include<stdio.h>the error is that when you have a recursive function like above you must keep a sequential line between its calls and not to break it. for instance(each one calls its previous ) 4!=3!*4=(2!*3)*4=( (1!*1*2)*3 )*4=((0!*1*2)*3)*4 without the return i added here you always return c as the result which is not changing. for more on this check this link http://www.java2s.com/Tutorial/C/016.../Recursion.htm |
| All times are GMT +5.5. The time now is 14:48. |