Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Code Samples & Tips
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Code Samples & Tips Share your recent discoveries and ideas with other users.

Average of an array

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-24-2009, 06:11 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 13,162
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default Average of an array

I was asked about calculating the average of values stored in an array.
So here is the answer:
Code:
Sub Globals
    
Dim values(0)
End Sub

Sub App_Start
    values() = 
Array(100,90,80,90,79,95)
    
Msgbox(calcAverage)
End Sub
Sub calcAverage
    sum = 
0
    
For i = 0 To ArrayLen(values())-1
        sum = sum + values(i)
    
Next
    
Return sum / ArrayLen(values())
End Sub
__________________
Basic4android documentation
Reply With Quote
  #2 (permalink)  
Old 01-09-2010, 08:11 PM
Newbie
 
Join Date: Nov 2009
Posts: 3
Default

Thank you very much!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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
Trackbacks are Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Array and Arraylist junglejet Questions (Windows Mobile) 2 02-09-2009 07:52 PM
array() as RETURNCODE in SUB kohle Questions (Windows Mobile) 4 02-05-2009 09:38 PM
TextBox.Text Average? cdeane Questions (Windows Mobile) 9 04-25-2008 07:25 PM
Array but not array Cableguy Questions (Windows Mobile) 1 09-22-2007 09:09 PM
Array of Array possibility? Stellaferox Basic4ppc Wishlist 0 09-18-2007 01:16 PM


All times are GMT. The time now is 09:47 PM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0