Question about ArcMedia JavaScript Source Code 3000 Pro (gar448) for PC

1 Answer

Code of array that calculates the sum and average of the five input values?

Posted by on

1 Answer

  • Level 3:

    An expert who has achieved level 3 by getting 1000 points

    All-Star:

    An expert that got 10 achievements.

    MVP:

    An expert that got 5 achievements.

    Vice President:

    An expert whose answer got voted for 100 times.

  • Master
  • 415 Answers

For int i=0; i< array.count; i++
{
sum+= array[i];

}

average = sum/5

Posted on Dec 30, 2009

Add Your Answer

Uploading: 0%

my-video-file.mp4

Complete. Click "Add" to insert your video. Add

×

Loading...
Loading...

Related Questions:

1 Answer

Create javascript code whose function is to compute the sum of two inputs?


Hello,
The following code will dynamically calculate the some of the first two fields:



Enter first number:
Enter second number:
Their sum is:

Best Regards, Ben

Jun 29, 2011 | Compilers & Programming Tools

1 Answer

Declare 2 arrays with 5 as index value of each. the user will input values to the first array(user-defined). Transfer value of the first array to the second array.Get the sum of the second...


You could do this by creating two arrays as such:
int firstArray[5]; int secondArray[5]
and then the sum variable:
int sum = 0;
then you could do a for loop to find the sum of the second array:

Feb 22, 2011 | Microsoft Visual C++ Professional Edition...

1 Answer

Twenty-five numbers are entered from the keyboard into an array.The number to be searched is entered through the keyboard by user.Write a program to find if the number to be searched is present in the...


pseudo is
-> integer type count =0;
->Take input from user 'Number'
->loop from 0th to 24th element
->Compare each element with user entered number and if it matches then do count++.
finally display the count.

Jul 29, 2010 | Advanced Graphics Programming Using OpenGL...

1 Answer

Auto calculated field in Foxpro (2.6 prefered)


Code example:
// all fields are numeric type
USE example APPEND BLANK REPLACE field_a WITH 25, field_b WITH 4, field_sum WITH field_a + field_b, field_prod WITH field_a * field_b APPEND BLANK REPLACE field_a WITH 60, field_b WITH 5, field_sum WITH field_a + field_b, field_prod WITH field_a * field_b
Result: field_a field_b field_sum field_prod 25 4 29 100 60 5 65 300
Don't use keywords as field names (ex. SUM).
Best regards

Jul 05, 2010 | Microsoft Visual FoxPro Professional...

2 Answers

C++ poker program


Hi.

I suggest creating an Array of Cards (cardOne,cardTwo,etc. to five)

If you can enter them in one at a time, after declaring the array, assign the values to the array.

cin < cardOne; (Psuedo code by the way, hope you don't mind)

Afterwards, you'll have an array with 5 cards.

Declare what full houses, flushes, etc would require.
Use an if statement (If you don't mind lots of code) to compare the entered Array against possible hands.

I didn't necessarily give you any specific C++ code. However, if you Google C++ user input, you should find plenty of commands that may help you.

Good Luck

(And not sure about Linear search to be honest, you can use a Linear search, but if you did it the way I explained, you just have to compare hand to a series of conditionals.)


Sep 23, 2009 | Compilers & Programming Tools

1 Answer

I am java beginner and I want a help in writing a java program to calculate the variance for an array of numbers


the best thing to do here is to separate the steps for calculating the variance into different functions. To compute the variance the first thing to do is to compute the mean or the average of the numbers in the array. so your first function will loop through each of the numbers and divide it by the length of your array. the output is the returned. The next thing to do is create another function for the variance. loop through each of the numbers again and subtract to each number the mean. square the value then add to the previous. so that means you have another variable that starts from zero and just adds the answer. after that divide it by the length of the array again and what you are going to get is the value for the variance.

May 13, 2009 | Compilers & Programming Tools

1 Answer

How to compute a class average using arrays


hi, here is the program #include<stdio.h> #include<conio.h> void main() { int class[30],i; float sum=0,avg=0; printf("enter marks"); for(i-0;i<30;i++) scanf("%d",&class[i]); for(i-0;i<30;i++)
sum+=class[i]; avg=sum/30; printf("%f",avg); getch(); }

May 08, 2009 | Microsoft Compilers & Programming Tools

1 Answer

A c program to implement transportation problem


#include<stdio.h>
#include<conio.h>

main()
{
int flag=0,flag1=0;
int s[10],d[10],sn,eop=1,dm,a[10][10];
int i,j,sum=0,min,x[10][10],k,fa,fb;

clrscr();
/* Getting The Input For the Problem*/

printf("Enter the number of Supply
");
scanf("%d",&sn);
printf("Enter the number of Demand
");
scanf("%d",&dm);
printf("Enter the Supply Values
");
for(i=0;i<sn;i++)
scanf("%d",&s[i]);
printf("Enter the Demand Values
");
for(j=0;j<sn;j++)
scanf("%d",&d[j]);
printf("Enter the elements of the array
");
for(i=0;i<sn;i++)
{
for(j=0;j<dm;j++)
{
scanf("%d",&a[i][j]);
}
}
/* Calculation For the Transportation */
i=0;j=0;
for(i=0,j=0;i<sn,j<dm;)
{
if(s[i]<d[j]) // Check supply less than demand
{
x[i][j]=a[i][j]*s[i]; // Calculate amount * supply
d[j]=d[j]-s[i]; // Calculate demand - supply
i++; // Increment i for the deletion of the row
or
column
}
else if(s[i]>=d[j]) //Check the supply greater than equal to
demand
{
x[i][j]=a[i][j]*d[j]; // Calculate amount * demand
s[i]=s[i]-d[j]; // Calculate supply - demand
j++; // Increment j for the deletion of the row
or
column
}

}
/* The Cost Matrix is Estimated here */
printf("Given Cost Matrix is :
");
for(fa=0;fa<sn;fa++)
{
for(fb=0;fb<dm;fb++)
{
printf("%d ",a[fa][fb]);
}
printf("
");
}
/* The Allocated Cost Matrix is */

printf("Allocated Cost Matrix is
");
for(fa=0;fa<sn;fa++)
{
for(fb=0;fb<dm;fb++)
{
printf("%d ",x[fa][fb]);
sum=sum+x[fa][fb];
}
printf("
");
}
/* Transportation Cost Estimated and Sum is Printed*/
printf("The Transportation cost:%d
",sum);
getch();
}

Apr 08, 2009 | Compilers & Programming Tools

1 Answer

A Program using an array that culculates the sum and average of the five input values?


Hi,
I am writing in C code here
#include<stdio.h>
#include<conio.h>
void main()
{
int a[5],i,sum=0;
float avg=0;
printf("enter the five values");
for(i=0;i<5;i++)
scanf("%d",&a[i]);
for(i=0;i<5;i++)
sum+=a[i];
printf("Sum=%d",sum);
avg=sum/5;
printf("Average=%f",avg);
getch();
}

Mar 18, 2009 | ArcMedia JavaScript Source Code 3000 Pro...

Not finding what you are looking for?
ArcMedia JavaScript Source Code 3000 Pro (gar448) for PC Logo

Related Topics:

104 people viewed this question

Ask a Question

Usually answered in minutes!

Top ArcMedia Compilers & Programming Tools Experts

Robin Hill
Robin Hill

Level 3 Expert

1251 Answers

Michael Thomas
Michael Thomas

Level 3 Expert

3051 Answers

Mike

Level 3 Expert

4331 Answers

Are you an ArcMedia Compiler and Programming Tool Expert? Answer questions, earn points and help others

Answer questions

Manuals & User Guides

Loading...