Computer Science Canada Programming C, C++, Java, PHP, Ruby, Turing, VB   Username:   Password: Wiki   Blog   Search   Turing   Chat Room  Members
odd even counting :D
Author Message
soulgnat

Posted: Wed Jan 21, 2004 3:34 pm   Post subject: odd even counting :D

this program will identify whether number is odd or even...

 code: var oddeven: array 1..7 of string var enternum: array 1..7 of int var x:int:=1 put "Enter 7 numbers" for i:1..7 put "Enter your # ",i,"pick" get enternum (i) if enternum (i) mod 2 not=0 then     oddeven (i):="odd" elsif enternum (i) mod 2= 0 then     oddeven (i):="even" end if x:=x+1 end for delay (300) cls for i:1..7     locate (i,10)     put enternum (i)     locate (i,20)     put oddeven (i) end for
[/code]

shorthair

Posted: Wed Jan 21, 2004 4:06 pm   Post subject: (No subject)

Please change your avatar to a smaller size , it makes the forum look messey , it occupys almost half of the page , Thanks , nice program by the way , i take it your new to turing ?
kalin

Posted: Wed Jan 21, 2004 5:28 pm   Post subject: (No subject)

please pick a smalled avatar or crop it down. Adn that is kinda neat too. The program I mean...
the_short1

Posted: Mon Feb 09, 2004 5:20 pm   Post subject: (No subject)

If you want a action to be executed only every odd repetition of loop try this:

 code: var num : int := 1 loop if num mod 2 not= 0 then % What you want done every second repitition of loop end if num := num + 1 end loop

i like your program only thing is it tells you which ones are odd and even...
i though i would do an extension of you work....

yea it took me a while to figure out how to make it go every odd repition.... untill i CjGauhan told me in class (use MOD) Duh!! .... i got 91% but i didn;t always listen to teacher cuz i had my headphones blaring...

I hope you have great suceess in your class... Computer Sciences is fun if you are able to listen to musik
Andy

Posted: Mon Feb 09, 2004 9:18 pm   Post subject: (No subject)

y would u need array for this?
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

Page 1 of 1  [ 5 Posts ]
 Jump to:  Select a forum  CompSci.ca ------------ - Network News - General Discussion     General Forums   -----------------   - Hello World   - Featured Poll   - Contests     Contest Forums   -----------------   - DWITE   - [FP] Contest 2006/2008   - [FP] 2005/2006 Archive   - [FP] 2004/2005 Archive   - Off Topic     Lounges   ---------   - User Lounge   - VIP Lounge     Programming -------------- - General Programming     General Programming Forums   --------------------------------   - Functional Programming   - Logical Programming   - C     C   --   - C Help   - C Tutorials   - C Submissions   - C++     C++   ----   - C++ Help   - C++ Tutorials   - C++ Submissions   - Java     Java   -----   - Java Help   - Java Tutorials   - Java Submissions   - Ruby     Ruby   -----   - Ruby Help   - Ruby Tutorials   - Ruby Submissions   - Turing     Turing   --------   - Turing Help   - Turing Tutorials   - Turing Submissions   - PHP     PHP   ----   - PHP Help   - PHP Tutorials   - PHP Submissions   - Python     Python   --------   - Python Help   - Python Tutorials   - Python Submissions   - Visual Basic and Other Basics     VB   ---   - Visual Basic Help   - Visual Basic Tutorials   - Visual Basic Submissions     Education ----------- - Student Life   Graphics and Design ----------------------- - Web Design     Web Design Forums   ---------------------   - (X)HTML Help   - (X)HTML Tutorials   - Flash MX Help   - Flash MX Tutorials   - Graphics     Graphics Forums   ------------------   - Photoshop Tutorials   - The Showroom   - 2D Graphics   - 3D Graphics     Teams ------ - dTeam Public

 Style: Appalachia blueSilver eMJay subAppalachia subBlue subCanvas subEmjay subGrey subSilver subVereor Search: