We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
HOW DO I CALCULATE THE FACTORIAL OF A NUMBER?
ive just tried
print "Factorial is" 69! "#CR"
but it does not work whats wrong?
HELLO IS ANYONE THERE?
ANSWER PLZ
Who are you?
Do you often assume that a public forum for end users is your private help desk, and that you should get an answer within minutes?
Google is your friend!
There are no available function evaluate the factorial, so you have to write one yourself. Your teacher should already have told you how to compute the factorial of a number, so the rest is a very good exercise!
By the way - are you sure you are on the correct forum?
Are you doing embedded systems programming using Keil development tools? In that case - what tools?
MY NAME IS RALF.
I THINK IT IS A TRICK QUESTION. THE ANSWER IS YOU CANNOT DO IT?
WHEN I ANSWER THIS I WILL BE DOING SOME TRAFIC LITES.
I THINK IT IS A TRICK QUESTION no need to SHOUT
I thought for about 5 seconds and then I knew how to do it. Why do you not think about it for a bit, it is not that complicated.
Erik
What programming language is that?
What Keil tools support it?
I think he is trying basic. The question is still which tool he tries to use to process the command.
Since new posts aren't comming in every 3 minutes, I figure he has received some answers on another forum somewhere.
HI ITS RALF HERE
DOES ANYONE HERE KNOW HOW TO DO IT? PLEASE HELP
I WANT TO DO THE TRAFIC LIGTES
Everyone here knows how to do it.
But for what use? The Keil tools can't handle Basic and it isn't meaningful to port a Basic interpreter to an embedded environment.
Besides, a traffic light does not need any factorials.
Besides, a traffic light does not need any factorials. and SHOUTING about it does not make it so.
Do you understand what a factorial means?
Do you know how to work it out by hand, using pencil and paper?
Computer Science textbooks typically take factorial calculation as an example for recursive functions.
The 8051 is particularly unsuited to recursive functions, so that would not be a good choice if you're thinking of doing it on an 8051. An iterative approach would be more appropriate.
In general, recursion is best avoided in embedded systems...
Few functions are so well suited for an iterative solution as the factorial. I have never really understood why the factorial is the #1 example of recursion.