abhas Active member
| Subject: ISC XII JAVA How to write program Algorithm Eg. Algo Wed Nov 25, 2009 7:44 pm | |
|
Algorithm to convert number to its binary equivalent
- Start
- Enter number whose binary equivalent is to be
found out.( n ß Input from user)
- Create
a copy of “n” and store it in “y”, and define integer type variable “i” with initial value 1
- Divide
y by 2, multiply the remainder by i. (i.e it is either 0 or 1)
- Multiply
remainder by i and add it to s.
- Multiply
i by 10.
- If y
is greater than 0 , go back to step 3.
- Print
“n” and “s”.
- Stop.
|
|