Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
- The problem statement, all variables and given/known data:
Design an algorithm that accepts an input a decimal number and converts it into BCD (Binary Coded Decimal) representation. Also, draw its Flow Chart.
- Relevant commands, code, scripts, algorithms:
UNIX
- The attempts at a solution (include all code and scripts):
1:[enter the number]
read n
2:[find the length]
leng=length(n)
a=0
3:[perform the conversion]
for i=0 to leng-1
n1=n1%2[to take the right most digit]
for j=0 to 3
n2=n1%2[to take the reminder]
ans[a]=n2
a\+\+
n1=n1/2
end for
n=n/10[to take the number except the right digit]
end for
[print the number]
fori=a-1 to 0
print ans
[i]end
- Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
IGNOU / NewDelhi / BCA
Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).