Forum FAQForum FAQSearchSearch MemberlistMemberlist Forum ignore listForum ignore list RegisterRegister ProfileProfile Log in to check your private messagesLog in to check your private messages Log inLog in
JavaScript - molim pomoć

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    mi3dot.org Forum Index -> Client-side
View previous topic :: View next topic  
Author Message
0viking0



Joined: 10 Sep 2003
Posts: 214
Location: Zagreb - Croatia

PostPosted: 21.04.2005 13:32    Post subject: JavaScript - molim pomoć Add user to your forum ignore list Reply with quote

...ovako, imamo vježbe iz Java Script-a. na faksu, a ja za programiranje nisam nadaren, pa molim ljude dobre volje za pomoć

Vježbe su glupave, al evo:

Ovo bi trebao biti program za ispis najvećeg broja :!: :?: no nešto ne štima. Negdje sam nešto promašio, ne znam što :?: Molim Vas pomoć. Unaprijed zahvalan

<HTML>
<HEAD>
<TITLE>Vjezba</TITLE>
<SCRIPT LANGUAGE ="JavaScript">
var n = parselnt (prompt ("Koliko brojeva zelis upisati?";""));
var polje = new Array ();
for (var i=0; i<n;i ++)
{polje [i] = parse Float (prompt("Upisi broj?";""))i}
max = polje[0]
for (var i=1; i<n; i ++)
{
if (polje [i]>max)
{max = polje [i];}
}
alert ("Najveci broj je "+max+","");
</SCRIPT>
</HEAD>
</HTML>


Drugi dio zadatka je taj da se ovaj kod prilagodi tako da se u program upisuje n brojeva, te da se ispiše njihova suma

FALA SVIMA UNAPRIJED

_________________
AND REMEMBER, KGB STILL WATCHING YOU
Back to top
View user's profile Send private message Send e-mail
lekke



Joined: 17 Jun 2004
Posts: 860
Location: 25th floor

PostPosted: 21.04.2005 13:43    Post subject: Re: JavaScript - molim pomoć Add user to your forum ignore list Reply with quote

0viking0 wrote:

{polje [i] = parse Float (prompt("Upisi broj?";""))i}


Nemam vremena isprobati, ali ovako na prvi pogled - kaj ce ti ovaj i na kraju reda?

_________________
You need more bass.
Back to top
View user's profile Send private message
Gale



Joined: 04 Apr 2005
Posts: 120

PostPosted: 21.04.2005 13:55    Post subject: Add user to your forum ignore list Reply with quote

Evo:

Code:

<HTML>
<HEAD>
<TITLE>Vjezba</TITLE>
<SCRIPT LANGUAGE ="JavaScript">

var n = parseInt(prompt ("Koliko brojeva zelis upisati?"));
var polje = new Array ();
for (var i=0; i<n;i++){
   polje[i] = parseFloat (prompt("Upisi broj?"));
}
max = polje[0];

for (var i=1; i<n; i ++){
   if(polje[i]>max){
      max = polje[i];
   }
}

alert("Najveci broj je "+max);
</SCRIPT>
</HEAD>
</HTML>
 
Back to top
View user's profile Send private message Visit poster's website
0viking0



Joined: 10 Sep 2003
Posts: 214
Location: Zagreb - Croatia

PostPosted: 21.04.2005 14:27    Post subject: Add user to your forum ignore list Reply with quote

...Isprobat ću kad dođem doma... hvala puno... e sad i drugi dio... zbroj n brojeva.

_________________
AND REMEMBER, KGB STILL WATCHING YOU
Back to top
View user's profile Send private message Send e-mail
Gale



Joined: 04 Apr 2005
Posts: 120

PostPosted: 21.04.2005 18:32    Post subject: Add user to your forum ignore list Reply with quote

Evo izvoliš:

Code:

<HTML>
<HEAD>
<TITLE>Vjezba</TITLE>
<SCRIPT LANGUAGE ="JavaScript">

var n = parseInt(prompt ("Koliko brojeva zelis upisati?"));
var polje = new Array ();
for (var i=0; i<n;i++){
   polje[i] = parseFloat (prompt("Upisi broj?"));
}

var zbroj = 0;

for (var i=0; i<n; i++){
      zbroj += polje[i];
}

alert("Zbroj je "+ zbroj);
</SCRIPT>
</HEAD>
</HTML>
Back to top
View user's profile Send private message Visit poster's website
0viking0



Joined: 10 Sep 2003
Posts: 214
Location: Zagreb - Croatia

PostPosted: 21.04.2005 21:42    Post subject: Add user to your forum ignore list Reply with quote

Stari imaš pivu.... čak i dvije...

_________________
AND REMEMBER, KGB STILL WATCHING YOU
Back to top
View user's profile Send private message Send e-mail
Gale



Joined: 04 Apr 2005
Posts: 120

PostPosted: 21.04.2005 22:21    Post subject: Add user to your forum ignore list Reply with quote

Very Happy
Back to top
View user's profile Send private message Visit poster's website
djipster
Guest





PostPosted: 22.04.2005 02:52    Post subject: Reply with quote

0viking0 wrote:
Stari imaš pivu.... čak i dvije...


hahaha...zakon...
moram priznat da si se mudro sjetio kako rijesit problem...
Back to top
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    mi3dot.org Forum Index -> Client-side All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group