•

Check out our Community Blogs

Register and join over 40,000 other developers!

Recent Blog Entries

• phi

I love this community !

• JackJames

hi i am jack i am seo expert jack james would love you to read new post

newb pascal help...

pascal

16 replies to this topic

#13 Mers

Mers

CC Newcomer

• Just Joined
• 11 posts

Posted 10 October 2008 - 06:54 AM

Hey,

I also got that task but I have to do it with 3 numbers.
I tried to think about a method to make it work with for loop but I couldn't find how...

```PROGRAM HighestNumber;
USES wincrt;
VAR
x,y,z:integer;
BEGIN
if (x>y) AND (x>z) then
writeln('The highest number is: ',x)
else
if (y>x) AND (y>z) then
writeln('The highest number is: ',y)
else
if(z>x) AND (z>y) then
writeln('The highest number is: ',z)
else
if (x=y) AND (x<>z) then
writeln('The highest number is: ',x)
else
if (y=z) AND (y<>x) then
writeln('The highest number is :',y)
else
if (z=x) AND (z<>y) then
writeln('The highest number is: ',z)
else
writeln('The highest number is: ',x);
END.```

• 0

#14 ooisootuck

ooisootuck

CC Regular

• Just Joined
• 29 posts

Posted 10 October 2008 - 07:06 AM

You mean you need to loop it ten times also?
• 0

#15 Mers

Mers

CC Newcomer

• Just Joined
• 11 posts

Posted 10 October 2008 - 07:48 AM

No,
I meant that I'm supposed to loop my code three times.
I tried to do that and the program just writes what's in the writeln. I want it to wait for my input and then finish the loop. How do I do that?
• 0

#16 ooisootuck

ooisootuck

CC Regular

• Just Joined
• 29 posts

Posted 10 October 2008 - 03:05 PM

```PROGRAM HighestNumber;
USES wincrt;
VAR
x,y,z, [COLOR="Red"]I[/COLOR]:integer;
BEGIN
[COLOR="Red"]for I := 1 to 3 do begin[/COLOR]
if (x>y) AND (x>z) then
writeln('The highest number is: ',x)
else
if (y>x) AND (y>z) then
writeln('The highest number is: ',y)
else
if(z>x) AND (z>y) then
writeln('The highest number is: ',z)
else
if (x=y) AND (x<>z) then
writeln('The highest number is: ',x)
else
if (y=z) AND (y<>x) then
writeln('The highest number is :',y)
else
if (z=x) AND (z<>y) then
writeln('The highest number is: ',z)
else
writeln('The highest number is: ',x);
[COLOR="Red"]end;[/COLOR]
END.
```
This should work.

Edited by WingedPanther, 11 October 2008 - 05:04 AM.

• 0

#17 Mers

Mers

CC Newcomer

• Just Joined
• 11 posts

Posted 12 October 2008 - 04:38 PM

I did that. It would loop it but write three times the writeln without letting me enter the numbers before it continues. Should I use beak loop or something? (Or i dunno I barely know what it means... im newb... )
• 0

Also tagged with one or more of these keywords: pascal

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download