Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 3rd, 2003, 04:00 PM
deerslayer deerslayer is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 6 deerslayer User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy Array of ten integers

I am trying to write a sub procedure that takes an array of ten integers and displays to picture box whether the sum of the integers is odd or even. please help

Reply With Quote
  #2  
Old December 3rd, 2003, 04:33 PM
unclefu unclefu is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 120 unclefu User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 30 m 57 sec
Reputation Power: 5
ok, so assuming you've got a picture for odd and a picture for even

Code:

sumOfArray = 0

for i = lbound(myArray) to ubound(myArray)
     sumOfArray = sumOfArray + myArray(i)
next

if sumOfArray mod 2 = 0 then
     'even - code to display even picture
else
     'odd - code to display odd picture
end if     

Reply With Quote
  #3  
Old December 5th, 2003, 10:50 PM
D·Hack D·Hack is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 8 D·Hack User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Or if you want to just use text, set the FontTransparent property to false and use this:

Code:
sumOfArray = 0

for i = lbound(myArray) to ubound(myArray)
     sumOfArray = sumOfArray + myArray(i)
next

if sumOfArray mod 2 = 0 then
     picSum.print "Sum is even"
else
     picSum.print "Sum is odd"
end if



The .print method doesn't pop up in that autocomplete list thing, but it's there. Really, it is.

Last edited by D·Hack : December 5th, 2003 at 10:54 PM.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > Array of ten integers


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway