• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 17:42
CEST 23:42
KST 06:42
  • 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
[ASL21] Ro4 Preview: On Course12Code S Season 1 - RO8 Preview7[ASL21] Ro8 Preview Pt2: Progenitors8Code S Season 1 - RO12 Group A: Rogue, Percival, Solar, Zoun13[ASL21] Ro8 Preview Pt1: Inheritors16
Community News
Weekly Cups (May 4-10): Clem, MaxPax, herO win1Maestros of The Game 2 announcement and schedule !10Weekly Cups (April 27-May 4): Clem takes triple0RSL Revival: Season 5 - Qualifiers and Main Event12Code S Season 1 (2026) - RO12 Results1
StarCraft 2
General
MaNa leaves Team Liquid Weekly Cups (May 4-10): Clem, MaxPax, herO win Code S Season 1 - RO8 Preview Behind the Blue - Team Liquid History Book Weekly Cups (April 27-May 4): Clem takes triple
Tourneys
2026 GSL Season 2 Qualifiers $5,000 WardiTV Spring Championship 2026 Maestros of The Game 2 announcement and schedule ! SC2 INu's Battles#16 <BO.9> Master Swan Open (Global Bronze-Master 2)
Strategy
Custom Maps
[D]RTS in all its shapes and glory <3 [A] Nemrods 1/4 players
External Content
Mutation # 525 Wheel of Misfortune The PondCast: SC2 News & Results Mutation # 524 Death and Taxes Mutation # 523 Firewall
Brood War
General
(Spoiler) Interview ASL Ro4 Day 2 Winner Data needed Flashes ASL S21 Ro8 Review ASL Tickets to Live Event Finals? Pros React To: Leta vs Tulbo (ASL S21, Ro.8)
Tourneys
[ASL21] Semifinals B [Megathread] Daily Proleagues [ASL21] Semifinals A [BSL22] RO16 Group Stage - 02 - 10 May
Strategy
[G] Hydra ZvZ: An Introduction Simple Questions, Simple Answers Fighting Spirit mining rates Muta micro map competition
Other Games
General Games
Nintendo Switch Thread Warcraft III: The Frozen Throne Starcraft Tabletop Miniature Game Stormgate/Frost Giant Megathread PC Games Sales Thread
Dota 2
The Story of Wings Gaming
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 TL Mafia Community Thread Five o'clock TL Mafia
Community
General
Russo-Ukrainian War Thread US Politics Mega-thread UK Politics Mega-thread YouTube Thread European Politico-economics QA Mega-thread
Fan Clubs
The IdrA Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece [Req][Books] Good Fantasy/SciFi books
Sports
2024 - 2026 Football Thread McBoner: A hockey love story Formula 1 Discussion
World Cup 2022
Tech Support
streaming software Strange computer issues (software) [G] How to Block Livestream Ads
TL Community
The Automated Ban List
Blogs
How EEG Data Can Predict Gam…
TrAiDoS
ramps on octagon
StaticNine
Funny Nicknames
LUCKY_NOOB
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1686 users

help with computing algorithms!

Blogs > GTR-2-Go
Post a Reply
GTR
Profile Blog Joined September 2004
51596 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
51596 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
Zurich15365 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
51596 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 States24772 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
Next event in 2h 18m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
JuggernautJason135
CosmosSc2 2
UpATreeSC 0
StarCraft: Brood War
910 30
Movie 24
Dota 2
qojqva1099
monkeys_forever278
NeuroSwarm79
Counter-Strike
fl0m5488
Super Smash Bros
PPMD22
Other Games
Grubby5415
summit1g2496
FrodaN1424
Beastyqt994
shahzam642
C9.Mang0247
Liquid`Hasu170
RotterdaM85
Livibee74
Organizations
Other Games
BasetradeTV81
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
[ Show 18 non-featured ]
StarCraft 2
• Hupsaiya 53
• Hinosc 30
• musti20045 29
• Reevou 8
• Migwel
• sooper7s
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
StarCraft: Brood War
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• masondota2808
Other Games
• imaqtpie1249
• Scarra724
• Shiphtur380
Upcoming Events
PiGosaur Cup
2h 18m
Replay Cast
11h 18m
Replay Cast
1d 2h
The PondCast
1d 12h
OSC
1d 12h
Replay Cast
2 days
RSL Revival
2 days
OSC
2 days
Korean StarCraft League
3 days
RSL Revival
3 days
[ Show More ]
BSL
3 days
GSL
4 days
Cure vs herO
SHIN vs Maru
BSL
4 days
Replay Cast
5 days
Replay Cast
6 days
The PondCast
6 days
Liquipedia Results

Completed

Proleague 2026-05-11
WardiTV TLMC #16
Nations Cup 2026

Ongoing

BSL Season 22
ASL Season 21
IPSL Spring 2026
KCM Race Survival 2026 Season 2
Acropolis #4
KK 2v2 League Season 1
BSL 22 Non-Korean Championship
Proleague 2026-05-12
SCTL 2026 Spring
RSL Revival: Season 5
2026 GSL S1
Asian Champions League 2026
IEM Atlanta 2026
PGL Astana 2026
BLAST Rivals Spring 2026
IEM Rio 2026
PGL Bucharest 2026
Stake Ranked Episode 1
BLAST Open Spring 2026
ESL Pro League S23 Finals
ESL Pro League S23 Stage 1&2

Upcoming

Escore Tournament S2: W7
YSL S3
Escore Tournament S2: W8
CSLAN 4
Kung Fu Cup 2026 Grand Finals
HSC XXIX
uThermal 2v2 2026 Main Event
Maestros of the Game 2
WardiTV Spring 2026
2026 GSL S2
BLAST Bounty Summer 2026: Closed Qualifier
Stake Ranked Episode 3
XSE Pro League 2026
IEM Cologne Major 2026
Stake Ranked Episode 2
CS Asia Championships 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.