We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,420 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Decimal to Binary

hi all..
i want to convert decimal to binary..

best regards..thanks.

4
Contributors
3
Replies
3 Days
Discussion Span
2 Years Ago
Last Updated
4
Views
Question
Answered
november_pooh
Junior Poster
124 posts since Mar 2008
Reputation Points: 29
Solved Threads: 0
Skill Endorsements: 0

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
function IntToBin( Value: integer; Digits: integer ): string;
begin
  result := StringOfChar ( '0', digits ) ;
    while value > 0 do begin
      if (value and 1) = 1 then
        result[digits] := '1';
      dec (digits) ;
      value := value shr 1;
    end;
end;
Wolfgan
Junior Poster
101 posts since Jun 2010
Reputation Points: 34
Solved Threads: 14
Skill Endorsements: 1
Question Answered as of 2 Years Ago by Wolfgan and Jx_Man

plz help!!! pascal tree using c sharp

Bilal gulbaz
Newbie Poster
4 posts since Feb 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0640 seconds using 2.64MB