Violet Posted May 14, 2009 Share Posted May 14, 2009 :nice: So what're you peeps up to? Link to comment Share on other sites More sharing options...
MK Posted May 14, 2009 Share Posted May 14, 2009 Ok, I gets it naow. program pr4; var a,b,c:integer; begin readln(a); readln(b); if a>b then c:=1 else c:=0; writeln©; readln; end. Never put a ; right before else, it won't wanna work. Also, you can left out the else part, if you don't need it. Like: program pr5; var a,b,c,:integer; begin readln(a); readln(b); if a<0 then a:=a*(-1); c:=a+b; writeln©; readln; end. Variables don't have to be called by only one letter, you can call them abc or whatever if you want. Also, try deleting the last readln and run the program to see what happens. Link to comment Share on other sites More sharing options...
MK Posted May 14, 2009 Share Posted May 14, 2009 HAI GUIZE. :D Oh, and Sara, I like the sig TONZ. :) Hi. :D Link to comment Share on other sites More sharing options...
noonsun Posted May 14, 2009 Author Share Posted May 14, 2009 Ok, I gets it naow. You talked just like me agains! :cheesy: Also, try deleting the last readln and run the program to see what happens. Ewwwww. That isn't good. Link to comment Share on other sites More sharing options...
MK Posted May 14, 2009 Share Posted May 14, 2009 On some competitions we have to leave out the last readln. Maybe I'll explain it later. :thinking: Are you having fun? :D Link to comment Share on other sites More sharing options...
Black Dog Posted May 14, 2009 Share Posted May 14, 2009 Why isn't this STILL their thread? Link to comment Share on other sites More sharing options...
noonsun Posted May 14, 2009 Author Share Posted May 14, 2009 Why isn't this STILL their thread? Because theoretically, other people are supposed to join in on our Intellectual Discourse. :P Link to comment Share on other sites More sharing options...
MK Posted May 14, 2009 Share Posted May 14, 2009 Read the first post, Clint. Link to comment Share on other sites More sharing options...
noonsun Posted May 14, 2009 Author Share Posted May 14, 2009 Okay! So where do we go from here? :P Link to comment Share on other sites More sharing options...
MK Posted May 14, 2009 Share Posted May 14, 2009 Oh, you...! :P program pr6; var n,i,x,s:integer; begin readln(n); for i:=1 to n do begin readln(x); s:=s+x; end; writeln(s); readln; end. See the yellow part? Well, you can also type the program like this: program pr6; var n,i,x,s:integer; begin readln(n); for i:=1 to n do begin readln(x); s:=s+x; end; writeln(s); readln; end. It doesn't matter. Edit: forum fail. Consider the _ as a space. program pr6; var n,i,x,s:integer; begin readln(n); for i:=1 to n do _begin __readln(x); __s:=s+x; _end; writeln(s); readln; end. Link to comment Share on other sites More sharing options...
noonsun Posted May 14, 2009 Author Share Posted May 14, 2009 Okay. That makes sense, because with the space indents, you can, like... organize it better, visually. yeah. edit: what does "for i:=1 to n do" mean? :huh: edit two: also you typed your program wrong I think :P did you mean "s:=i+x;" instead of "s:=s+x;"? Link to comment Share on other sites More sharing options...
MK Posted May 14, 2009 Share Posted May 14, 2009 It's a loop that repeats n times. But you can put, for example, for i:=2 to 5 do s:=s+i; I don't know if you noticed, but I put another begin and end in my previous post. If in a loop or under an if/else, or something other (I can't tell you everything now!), exists more than 1 command, you need an extra begin-end. That said, I don't need it in this post. But I could've put it, no harm will be done. Link to comment Share on other sites More sharing options...
noonsun Posted May 14, 2009 Author Share Posted May 14, 2009 :inquisitive: Okay, I think I got it. Possibly. Link to comment Share on other sites More sharing options...
MK Posted May 14, 2009 Share Posted May 14, 2009 @your edit 2: No, it's not wrong. Link to comment Share on other sites More sharing options...
noonsun Posted May 14, 2009 Author Share Posted May 14, 2009 But... but but it didn't do what it was supposed to do when I tried it. Or maybe I just don't know what it's supposed to do :lol: Link to comment Share on other sites More sharing options...
MK Posted May 14, 2009 Share Posted May 14, 2009 What? :confused: Link to comment Share on other sites More sharing options...
noonsun Posted May 14, 2009 Author Share Posted May 14, 2009 Exactly what I was thinking :lol: What was that program SUPPOSED to do? Wasn't it supposed to, like........ add stuff? O_o Link to comment Share on other sites More sharing options...
MK Posted May 14, 2009 Share Posted May 14, 2009 Eh. My bad. I guess my brain is shut down by now. :lol: program pr6; var n,i,x,s:integer; begin readln(n); s:=0; for i:=1 to n do begin readln(x); s:=s+x; end; writeln(s); readln; end. Link to comment Share on other sites More sharing options...
noonsun Posted May 14, 2009 Author Share Posted May 14, 2009 oooohhh :surprised: wait, no, still not working :P Link to comment Share on other sites More sharing options...
MK Posted May 14, 2009 Share Posted May 14, 2009 Huh. What do you type when the program starts? Link to comment Share on other sites More sharing options...
noonsun Posted May 14, 2009 Author Share Posted May 14, 2009 um. oh I'm an idiot XD I put in "1" even though I..... shouldn't have. Jkz. Link to comment Share on other sites More sharing options...
MK Posted May 14, 2009 Share Posted May 14, 2009 I think you learned enough today. :D This is fuuunnnn. :wacko: Link to comment Share on other sites More sharing options...
noonsun Posted May 14, 2009 Author Share Posted May 14, 2009 Yeah, it is. :smart: I feel so nerdy, though. Link to comment Share on other sites More sharing options...
MK Posted June 8, 2009 Share Posted June 8, 2009 *saves thread from the depths of The Lounge* Still remember what I've learned you? Can we move on? :D Link to comment Share on other sites More sharing options...
noonsun Posted June 8, 2009 Author Share Posted June 8, 2009 .........No, and no. :P Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now