• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 02:13
CET 08:13
KST 16:13
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
Rongyi Cup S3 - RO16 Preview3herO wins SC2 All-Star Invitational12SC2 All-Star Invitational: Tournament Preview5RSL Revival - 2025 Season Finals Preview8RSL Season 3 - Playoffs Preview0
Community News
Weekly Cups (Jan 12-18): herO, MaxPax, Solar win0BSL Season 2025 - Full Overview and Conclusion8Weekly Cups (Jan 5-11): Clem wins big offline, Trigger upsets4$21,000 Rongyi Cup Season 3 announced (Jan 22-Feb 7)22Weekly Cups (Dec 29-Jan 4): Protoss rolls, 2v2 returns7
StarCraft 2
General
PhD study /w SC2 - help with a survey! herO wins SC2 All-Star Invitational Oliveira Would Have Returned If EWC Continued StarCraft 2 not at the Esports World Cup 2026 [Short Story] The Last GSL
Tourneys
$21,000 Rongyi Cup Season 3 announced (Jan 22-Feb 7) OSC Season 13 World Championship $70 Prize Pool Ladder Legends Academy Weekly Open! SC2 All-Star Invitational: Jan 17-18 Sparkling Tuna Cup - Weekly Open Tournament
Strategy
Simple Questions Simple Answers
Custom Maps
[A] Starcraft Sound Mod
External Content
Mutation # 509 Doomsday Report Mutation # 508 Violent Night Mutation # 507 Well Trained Mutation # 506 Warp Zone
Brood War
General
Fantasy's Q&A video [ASL21] Potential Map Candidates BGH Auto Balance -> http://bghmmr.eu/ BW General Discussion Gypsy to Korea
Tourneys
[Megathread] Daily Proleagues Azhi's Colosseum - Season 2 Small VOD Thread 2.0 [BSL21] Non-Korean Championship - Starts Jan 10
Strategy
Current Meta Simple Questions, Simple Answers Soma's 9 hatch build from ASL Game 2 Game Theory for Starcraft
Other Games
General Games
Nintendo Switch Thread Battle Aces/David Kim RTS Megathread Stormgate/Frost Giant Megathread Beyond All Reason Awesome Games Done Quick 2026!
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
Vanilla Mini Mafia Mafia Game Mode Feedback/Ideas
Community
General
US Politics Mega-thread Russo-Ukrainian War Thread European Politico-economics QA Mega-thread Canadian Politics Mega-thread NASA and the Private Sector
Fan Clubs
The herO Fan Club! The IdrA Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece
Sports
2024 - 2026 Football Thread
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List
Blogs
How Esports Advertising Shap…
TrAiDoS
My 2025 Magic: The Gathering…
DARKING
Life Update and thoughts.
FuDDx
How do archons sleep?
8882
James Bond movies ranking - pa…
Topin
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1781 users

help with computing algorithms!

Blogs > GTR-2-Go
Post a Reply
GTR
Profile Blog Joined September 2004
51522 Posts
Last Edited: 2008-06-01 09:55:31
June 01 2008 09:52 GMT
#1
any programmers out there? i have an algorithm assignment and i'm kind of having troubles understanding some of it, yes it is easy but i ain't really a pro at this stuff

1)
Begin
  get Num (an integer) from user
  set Count to 0
  While Count < Num
    set Temp to Count + 1
    print Temp
    increment Count
  Endwhile
  Print Count
End

What is the output after the users enter a value of 3 - I assume it is 3?
"" value of -1 - Nothing right? Since the Num is greater than the count.

2)
Begin
  read A
  While A > 0
    set Answer to 'No'
    If A > 8 Then
    set Answer to 'Yes'
  Endif
  print Answer
  Read A
  EndWhile
End

If 8, 3 then 0 were read in sequence, what would the output be - I have no idea what this means.

3) Write an algorithm in both psuedocode and flowchart that will print out the first 20 odd numbers.
Something simple I imagine, some sort of loop?

4) Write an algorithm in "" that will allow you to enter a student's name, enter 4 test marks out of 10 then print out the student's name and the average of the 4 tests.
I assume there will be an input, a loop for inputting marks and the print of the name and the mean of the marks?

help, i suck at this badly.

f

Commentator
BroOd
Profile Blog Joined April 2003
Austin10833 Posts
June 01 2008 10:16 GMT
#2
I hate you.
ModeratorSIRL and JLIG.
imDerek
Profile Blog Joined August 2007
United States1944 Posts
June 01 2008 10:24 GMT
#3
algorithm 1 prints all the positive integers less than or equal to the input, then print the input itself (cus of the "Print Count" after the while loop) ,so if you input 3, you get 1 2 3 3. If you input -1, you get -1
Least favorite progamers: Leta, Zero, Mind, Shine, free, really <-- newly added
GTR
Profile Blog Joined September 2004
51522 Posts
June 01 2008 10:44 GMT
#4
On June 01 2008 19:24 imDerek wrote:
algorithm 1 prints all the positive integers less than or equal to the input, then print the input itself (cus of the "Print Count" after the while loop) ,so if you input 3, you get 1 2 3 3. If you input -1, you get -1


if you inputted -1 wouldn't it be just a print count of 0 because if the count is set to 0, the loop is skipped since your number is -1?
Commentator
stenole
Profile Blog Joined April 2004
Norway869 Posts
June 01 2008 10:54 GMT
#5
Insead of dumping your entire homework into your blog, why don't you just specifically tell us what you are having trouble with. And like you pointed out, input of -1 gives output of 0, because that is what the count variable was initiated as and it hasnt been changed.
zatic
Profile Blog Joined September 2007
Zurich15359 Posts
Last Edited: 2008-06-01 11:01:59
June 01 2008 10:57 GMT
#6
3)
i = 1
while i < 42
print i
increment i by 2
ModeratorI know Teamliquid is known as a massive building
Bockit
Profile Blog Joined November 2004
Sydney2287 Posts
Last Edited: 2008-06-01 11:01:42
June 01 2008 11:01 GMT
#7
Us telling you the output isn't gonna help you out much.

My suggestion if you are having trouble is to do a desk check, i.e. go through the algorithm step by step and write down the variables and their values at each point, and any output the algorithm generates.
Their are four errors in this sentance.
imDerek
Profile Blog Joined August 2007
United States1944 Posts
June 01 2008 11:02 GMT
#8
On June 01 2008 19:44 GTR-2-Go wrote:
Show nested quote +
On June 01 2008 19:24 imDerek wrote:
algorithm 1 prints all the positive integers less than or equal to the input, then print the input itself (cus of the "Print Count" after the while loop) ,so if you input 3, you get 1 2 3 3. If you input -1, you get -1


if you inputted -1 wouldn't it be just a print count of 0 because if the count is set to 0, the loop is skipped since your number is -1?


right, sorry bout that
Least favorite progamers: Leta, Zero, Mind, Shine, free, really <-- newly added
evanthebouncy!
Profile Blog Joined June 2006
United States12796 Posts
June 01 2008 11:33 GMT
#9
For number 3, in scheme:

STk> (define (waa)
(define (wee x)
(if (= x 20)
nil
(cons (+ 1 (* 2 x)) (wee (+ x 1)))))
(wee 0))
waa

STk> (waa)
(1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39)

I'll explain:
(waa) is a loop, it basically runs another recursive function w/ input of 1, this function is called wee

How wee work:
wee is a function that takes input, that are actually indexes of the odd number, 1 would be indexed 0, 3 is 1, 5 is 2 on the index, and so on...

if input=20, gives nothing, so it terminates.
if input<20, add to the front of the array (2*input + 1), the corresponding odd number to the index, and recursively construct the rest of the array with input+1, the next index.

I dunno if its clear ~~
Life is run, it is dance, it is fast, passionate and BAM!, you dance and sing and booze while you can for now is the time and time is mine. Smile and laugh when still can for now is the time and soon you die!
GTR
Profile Blog Joined September 2004
51522 Posts
June 01 2008 11:41 GMT
#10
Alright, did this finally, just used some help from a programming friend (hi stenole).

Thanks for the help.
Commentator
stenole
Profile Blog Joined April 2004
Norway869 Posts
June 01 2008 12:10 GMT
#11
On June 01 2008 20:33 evanthebouncy! wrote:
I'll explain:
(waa) is a loop, it basically runs another recursive function w/ input of 1, this function is called wee

If we ever worked on a programming project together, I would probably have to kill you. wee and waa are not good names for things unless you are trying to make code unreadable on purpose.
Lisk
Profile Blog Joined May 2006
Latvia376 Posts
June 01 2008 14:38 GMT
#12
Wow, I just can't read without () and {} ...
boss420
Profile Blog Joined March 2008
Cyprus109 Posts
June 01 2008 15:08 GMT
#13
<br>hi</br>

coding pro right here
micronesia
Profile Blog Joined July 2006
United States24753 Posts
June 01 2008 17:28 GMT
#14
void isgtrgay()
{
char gtrgay='y';
while (gtrgay=='y')
{
cout << "GTR is gay for that match last night!\n";
}
return;
}
ModeratorThere are animal crackers for people and there are people crackers for animals.
tec27
Profile Blog Joined June 2004
United States3702 Posts
Last Edited: 2008-06-01 19:01:09
June 01 2008 19:00 GMT
#15
On June 02 2008 00:08 boss420 wrote:
<br>hi</br>

coding pro right here

You can't close a break tag like that... its a singular tag, it doesn't enclose anything (and the proper way to do it would be <br /> )

Can you jam with the console cowboys in cyberspace?
evanthebouncy!
Profile Blog Joined June 2006
United States12796 Posts
June 01 2008 23:16 GMT
#16
On June 01 2008 21:10 stenole wrote:
Show nested quote +
On June 01 2008 20:33 evanthebouncy! wrote:
I'll explain:
(waa) is a loop, it basically runs another recursive function w/ input of 1, this function is called wee

If we ever worked on a programming project together, I would probably have to kill you. wee and waa are not good names for things unless you are trying to make code unreadable on purpose.

chill :p I'm more of a mathmatics major
Life is run, it is dance, it is fast, passionate and BAM!, you dance and sing and booze while you can for now is the time and time is mine. Smile and laugh when still can for now is the time and soon you die!
Please log in or register to reply.
Live Events Refresh
Replay Cast
00:00
Rongyi Cup S3 - Group B
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
RuFF_SC2 280
Nina 166
StarCraft: Brood War
Zeus 151
Larva 59
Shuttle 53
Noble 15
NotJumperer 9
Dota 2
monkeys_forever393
febbydoto112
League of Legends
JimRising 821
C9.Mang0469
Super Smash Bros
Mew2King118
Other Games
summit1g7777
gofns2996
WinterStarcraft536
Organizations
Other Games
gamesdonequick1206
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 11 non-featured ]
StarCraft 2
• davetesta63
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Upcoming Events
Replay Cast
1h 48m
RongYI Cup
3h 48m
Maru vs Cyan
Solar vs Krystianer
uThermal 2v2 Circuit
4h 48m
BSL 21
7h 48m
Replay Cast
16h 48m
Wardi Open
1d 6h
Monday Night Weeklies
1d 9h
OSC
1d 16h
Replay Cast
2 days
WardiTV Invitational
2 days
[ Show More ]
Replay Cast
3 days
WardiTV Invitational
3 days
The PondCast
4 days
Korean StarCraft League
5 days
Replay Cast
6 days
Liquipedia Results

Completed

Escore Tournament S1: W5
OSC Championship Season 13
Tektek Cup #1

Ongoing

C-Race Season 1
BSL 21 Non-Korean Championship
CSL 2025 WINTER (S19)
KCM Race Survival 2026 Season 1
Acropolis #4 - TS4
Rongyi Cup S3
Underdog Cup #3
BLAST Bounty Winter 2026
BLAST Bounty Winter Qual
eXTREMESLAND 2025
SL Budapest Major 2025
ESL Impact League Season 8
BLAST Rivals Fall 2025

Upcoming

Escore Tournament S1: W6
Escore Tournament S1: W7
Acropolis #4
IPSL Spring 2026
uThermal 2v2 2026 Main Event
Bellum Gens Elite Stara Zagora 2026
HSC XXVIII
Nations Cup 2026
PGL Bucharest 2026
Stake Ranked Episode 1
BLAST Open Spring 2026
ESL Pro League Season 23
ESL Pro League Season 23
PGL Cluj-Napoca 2026
IEM Kraków 2026
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2026 TLnet. All Rights Reserved.