Question #263347

Write an Program Plan, Algorithm and draw a flowchart that will convert a given decimal number (N10) to its equivalent Binary number (N2).


Expert's answer

Program Plan
1. Declare variables
2. Read decimal number
3. Create while and for statements
4. Display result




Algorithm:


Start
    Declare variables decimal, index, result
    Declare array binary[] 
    Read decimal
    Set index = 0
    while decimal > 0 do
       binary[index] = decimal mod 2
       index=index+1
       decimal = decimal/2
    end while
    for i = index-1 to 0 Step -1
       Set result=result+binary[i]
    End for
    Display result  
Stop




Flowchart





Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS