Outline · Standard · [ Linear+ ]

> Pretvaranje decimalnog zapisa u binarni, Pascal

Laza_91
post May 27 2007, 06:38 PM
Post #1





Group: Članovi
Joined: 20-May 06
Member No.: 63



E jel moze neko da mi napise funkciju za prevodjenje broja iz dekadnog u binarni brojni sistem...
Do sutra...Ako je moguce sad.gif
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
 
Reply to this topicStart new topicStart Poll
Replies(1 - 12)
pyost
post May 27 2007, 06:43 PM
Post #2


Deus Ex Makina
Group Icon

Group: Administratori
Joined: 25-January 06
From: Beograd
Member No.: 2
Status: Bivši učenik MGa
Škola/Razred: RAF



Pascal?


--------------------
Baby, it's a violent world.

Registrovani korisnik Linuxa broj 460770 [Ubuntu 7.10]
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Laza_91
post May 27 2007, 06:44 PM
Post #3





Group: Članovi
Joined: 20-May 06
Member No.: 63



aha
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
pyost
post May 27 2007, 06:50 PM
Post #4


Deus Ex Makina
Group Icon

Group: Administratori
Joined: 25-January 06
From: Beograd
Member No.: 2
Status: Bivši učenik MGa
Škola/Razred: RAF



CODE
function decBin(broj:integer):integer;
var
  vrednost,mnozilac: integer;
begin
    vrednost:=0;
    mnozilac:=1;

    while broj<>0 do
    begin
         vrednost:=vrednost+(broj mod 2)*mnozilac;
         broj:=broj div 2;
         mnozilac:=mnozilac*10;
    end;

    decBin:=vrednost;
end;


--------------------
Baby, it's a violent world.

Registrovani korisnik Linuxa broj 460770 [Ubuntu 7.10]
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Laza_91
post May 27 2007, 06:51 PM
Post #5





Group: Članovi
Joined: 20-May 06
Member No.: 63



e hvala
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
pyost
post May 27 2007, 06:52 PM
Post #6


Deus Ex Makina
Group Icon

Group: Administratori
Joined: 25-January 06
From: Beograd
Member No.: 2
Status: Bivši učenik MGa
Škola/Razred: RAF



No problem


--------------------
Baby, it's a violent world.

Registrovani korisnik Linuxa broj 460770 [Ubuntu 7.10]
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Puzzler
post May 27 2007, 06:56 PM
Post #7





Group: Članovi
Joined: 2-July 06
Member No.: 74
Status: Van MGa
Škola/Razred: MG/IIb (proud of it)



C C C Lazo, radiš seminarski u poslednji, ama baš poslednji čas... blink.gif


--------------------
user posted image
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
username
post Feb 17 2008, 06:28 PM
Post #8





Group: Članovi
Joined: 29-September 07
Member No.: 684
Status: Bivši učenik MGa



(da ne otvaram novi topic samo zbog ovoga)
jel moze neko da mi napise program u pascalu kako da od broja n izmenim redosled cifara tako da dobijem najvisi i najmanji broj?
edit:napravim var-ove koji broje nule,jedinice...,devetke i onda tako preraspodelim?

This post has been edited by username: Feb 17 2008, 06:32 PM
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
username
post Feb 17 2008, 07:07 PM
Post #9





Group: Članovi
Joined: 29-September 07
Member No.: 684
Status: Bivši učenik MGa



CODE

program MinBC;
var n,a0,a1,a2,a3,a4,a5,a6,a7,a8,a9,t:integer;
begin
readln(n);
t:=1;
while not n div t <10 do
t:=t*10;
a0:=0;
a1:=0;
a2:=0;
a3:=0;
a4:=0;
a5:=0;
a6:=0;
a7:=0;
a8:=0;
a9:=0;
repeat
case n mod 10 of
0: a0:=a0+1;
1: a1:=a1+1;
2: a2:=a2+1;
3: a3:=a3+1;
4: a4:=a4+1;
5: a5:=a5+1;
6: a6:=a6+1;
7: a7:=a7+1;
8: a8:=a8+1;
9: a9:=a9+1
end;
n:=n div 10;
until n=0;
while a9>0 do
begin
n:=n+9*t;
a9:=a9-1;
t:=t div 10;
end;
while a8>0 do
begin
n:=n+8*t;
a8:=a8-1;
t:=t div 10;
end;
while a7>0 do
begin
n:=n+7*t;
a7:=a7-1;
t:=t div 10;
end;
while a6>0 do
begin
n:=n+6*t;
a6:=a6-1;
t:=t div 10;
end;
while a5>0 do
begin
n:=n+5*t;
a5:=a5-1;
t:=t div 10;
end;
while a4>0 do
begin
n:=n+4*t;
a4:=a4-1;
t:=t div 10;
end;
while a3>0 do
begin
n:=n+3*t;
a3:=a3-1;
t:=t div 10;
end;
while a2>0 do
begin
n:=n+2*t;
a2:=a2-1;
t:=t div 10;
end;
while a1>0 do
begin
n:=n+1*t;
a1:=a1-1;
t:=t div 10;
end;
writeln(n);
readln;
end.


This post has been edited by username: Feb 17 2008, 07:19 PM
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
pyost
post Feb 17 2008, 07:09 PM
Post #10


Deus Ex Makina
Group Icon

Group: Administratori
Joined: 25-January 06
From: Beograd
Member No.: 2
Status: Bivši učenik MGa
Škola/Razred: RAF



Mnogo je to zakomplikovano... Jeste li radili nizove?


--------------------
Baby, it's a violent world.

Registrovani korisnik Linuxa broj 460770 [Ubuntu 7.10]
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
username
post Feb 17 2008, 07:15 PM
Post #11





Group: Članovi
Joined: 29-September 07
Member No.: 684
Status: Bivši učenik MGa



nismo, evo malo sam ispravio, sad gasi program iako sam stavio readln
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
pyost
post Feb 17 2008, 07:17 PM
Post #12


Deus Ex Makina
Group Icon

Group: Administratori
Joined: 25-January 06
From: Beograd
Member No.: 2
Status: Bivši učenik MGa
Škola/Razred: RAF



E pa ako ne radite sa nizovima, nema svrhe pisati ovako glup program...


--------------------
Baby, it's a violent world.

Registrovani korisnik Linuxa broj 460770 [Ubuntu 7.10]
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
maxydelanoche
post Feb 17 2008, 11:17 PM
Post #13





Group: Članovi
Joined: 3-May 06
From: Zion
Member No.: 61
Status: Van MGa



Hahahahhaha... Ovo me podseca na to kad sam u osmom neki zadatak pokusala da resim bez matrica. Imala sam osam nizova sa po osam clanova. Kad sam shvatila koliko mi linija krajnje perverznog koda treba, ukljucila sam help i nasla kako se kreiraju matrice XD.gif


--------------------
Mi znamo sta se desava sa ljudima koji zastanu nasred puta. Bivaju pregazeni.
Nista nije nemoguce. Za nemoguce je samo potrebno malo vise vremena.

I'm doing the best I ever did, I'm doing the best that I can.

www.viva-fizika.org
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

Reply to this topicTopic OptionsStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members: