Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers > 8051/8951


8051/8951 A specify forum for the Intel 8051/8951 single chip microcontroller.

Reply
 
Tools
Old 6th November 2009, 05:53 PM   #1
Post Factorial of a no

I m having trouble with keil for 89c51. I want to find out factorial of a no. On keil. No are from 0-9. When the answer is greater than 255 we need to split the term in 2 memory locations but i dont know how it can be done.can anyone help me plz....
ElectronicsDevil is offline  
Old 6th November 2009, 06:40 PM   #2
Default

Since your numbers are from 0-9, the factorial result can go up to 362880 (factorial of 9), which I think will require more than 2 memory locations. One way is to store individual digits (ones, tens, hundreds, ...) to different locations. You can do that by dividing by 10 and saving the reminder.

- Raj
Experiments with PIC16F628A
rajbex is offline  
Reply

Tags
factorial, keil, program, trouble

Thread Tools
Display Modes




All times are GMT. The time now is 01:53 AM.


Electronic Circuits  |  Learning Electronics
eXTReMe Tracker