Discussion in 'Assembly Language Programming (ALP) Forum' started by nithyasj, Oct 2, 2009.
can you explain me how to write an assembly program in 8085 to find square root of a number
What algorithm are you using, and are you using floating point or integer arithmetic?
actually i dont know how to write an assembly programming.cant we use both integer & floating point numbers?
So why do you want us to explain how to write an assembly program to do square roots? Are you on a course and haven't been paying attention?
Before you can write a program you need to know how to do what your program will do. You can't just say to the computer "do a square root" cos it won't know what that means. So you need to start with an algorithm for working out square roots (and I don't mean "enter the number then press the square root key"). Once you know how to work out square roots you can then start learning assembly and in the process of that, see what instructions you will need to implement that algorithm,
One way to work out the square root of X is to start with N=1 and see if N*N is less than or equal to X. If it is then increment it and repeat. When N*N is greater than X you know you've gone past it, so decrement N and that is the closest integer to the true square root of X. This is a fairly easy program do to in any language, but of course you need to know how to write programs, which you should already know how to do if you're on a programming course and your teacher has just said "Right, now write a program to do square roots".
Separate names with a comma.