try this following code :
Program Decimal_Binary;
Uses WinCrt;
Var
Dec,Deci: Integer;
Bin: String;
Ul:Char;
Begin
Repeat
Clrscr;
Writeln('Decimal to Binary Convertion Program');
Writeln('======================================');
Writeln;
Write('Input Decimal Number: ');Readln(Dec);
Deci:=Dec;
Bin:='';
Repeat
If(Dec Mod 2 = 0) Then
Bin:='0'+Bin
Else
Bin:='1'+Bin;
Dec:=Dec Div 2;
Until Des=0;
Writeln;
Writeln(Deci,' Decimal = ',Bin,' Binary');
Writeln;
Write('Try Again? [Y/N]: ');Readln(Ul);
Ul:=Upcase(Ul);
Until (Ul<>'Y');
End.
hope it helps
Jx_Man
Senior Poster
3,536 posts since Nov 2007
Reputation Points: 1,488
Solved Threads: 524
Skill Endorsements: 64
Question Answered as of 2 Years Ago by
Wolfgan
and
Jx_Man