1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Artemon [7]
3 years ago
7

Write an algorithm to find the average of three numbers: 10, 20, 30

Computers and Technology
1 answer:
STALIN [3.7K]3 years ago
3 0

Language: JavaScript

Answer:

let num = [10,20,30];

average(num);  

function average(num) {

 let sum = 0;

 for(let i in num) {

   sum += num[i];

 }  

 return console.log(sum/num.length);

}

You might be interested in
So what do I do if it doesn't take me to the sign up page? I
vesna_86 [32]

Answer:

Try to restart the computer or something.

Explanation:

8 0
3 years ago
Give an efficient algorithm to find all keys in a min heap that are smaller than a provided valueX. The provided valuedoes notha
OlgaM077 [116]

Answer:

Starting from root, recursively traverse the min-heap. Once we find a key with value less than our X, we know that every key in subtree of that key will be also smaller than our X. Otherwise, we should keep traversing.

Explanation:

The complexity of this algorithm will be O(N) where N is the number of keys in our min-heap.

3 0
3 years ago
How do u friend ppl on iPhone and do I need to be at a certain level to do so?
andrey2020 [161]
Launch the game center app , tap on the friends tab , <span>tap the </span>plus sign in the upper left hand corner , <span>type in their cgme center id , then send . </span>
3 0
4 years ago
Name the tools and materials used in electrical installation job below.​
kow [346]
Voltage tester, Circuit finder, Screwdrivers and nut drivers specific to electricians, Pliers, measuring tape
8 0
3 years ago
Create a class ""Student"" that will hold an array of grades and has a method to calculate the average. It would also have a met
morpeh [17]

Answer:

#include <iostream>

#include<time.h>

using namespace std;

class Student

{

   public :

   int grades[20]; //array of grades

   

   double average(int arr[],int n) //method to calculate average of array of grades passed

   {

       int sum=0;

       for(int i=0;i<n;i++)  //loop to calculate sum of all grades

           sum=sum+arr[i];

       return sum/n;   //average is sum of items/number of items

   }

   int get_grade() //method to return grade number(1-14)

   {

       srand(time(NULL));  //method to generate different random number each time

       int num = rand() % 14 + 1;  //method to generate random number b/w 1-14

       return num;

   }

};

int main()

{

   Student s;

   int grade[]={5,3,9,8,10};

   cout<<"Average is : "<<s.average(grade,5);

   return 0;

}

OUTPUT :

Average is : 7

Explanation:

A class Student is created in which a method named average is there to calculate average of the grades passed and a method to generate a grade number b/w 1-14.

5 0
3 years ago
Other questions:
  • A company requires an Ethernet connection from the north end of its office building to the south end. The distance between conne
    8·1 answer
  • __________ is the brain of a computer.<br><br> A. Hardware<br> B. CPU<br> C. Memory<br> D. Disk
    13·2 answers
  • FILL IN THE BLANK.
    15·1 answer
  • What computer device works like a central nervous system?
    11·1 answer
  • The title element in the head section of an HTML document specifies the text
    14·1 answer
  • The interactive process through which people learn the basic skills, values, beliefs, and behavior patterns of a society.
    6·1 answer
  • Need help ASAP??? Pick the best answers
    10·1 answer
  • Why computer is known as versatile and diligent device? Explain​
    7·1 answer
  • Explain what iteration is and why we need it in code
    11·1 answer
  • What are 15 importance of information processing cycle?
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!