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
dimaraw [331]
3 years ago
10

Using the constant, declare a 1D array to store 10 integers ii. Write a loop that fills the array with 10 random numbers g

Computers and Technology
1 answer:
Airida [17]3 years ago
5 0

Answer:

Following are the code to this question:

#include <iostream>//defining header file

#include <cstdlib>//defining header file

using namespace std;

int main()//defining main method

{

const int ax[10]={1,2,3,4,5,6,7,8,9,10};//defining a const array ax that store 10 numbers

int r_num[10];//defining an array r_num

int i;//defining integer variable

for(i=0;i<10;i++)//defining for loop to calculate and store random numbers in array

{

   r_num[i]=rand()%100; //use rand function to store value in array

}

cout<<"Elements of the array that stores 10 random numbers: "<<endl;//print message

for(i=0;i<10;i++)//defining for loop for print array value

{

   cout<<r_num[i]<<endl;//print array value

}

return 0;

}

Output:

Elements of the array that stores 10 random numbers:  

83

86

77

15

93

35

86

92

49

21

Explanation:

In the above-given program, two arrays "ax, and r_num" is declared that store value in it, in which the ax array use the const keyword and in the r_num it uses the loop and random function which can be defined as follows:

In the second array "r_num", two for loop is declared, in which the first loop uses the rand function to store value in the array, and in the second array, it prints the value of the array.

You might be interested in
A programmer writes a for statement to count from 1 to 10 and explicitly mentions the 1 and the 10 in the for “header.” which re
o-na [289]
The relational operator used would probably be <=
6 0
3 years ago
What is a computer network?
Contact [7]

Answer:

A computer network is a group of two or more computers that are linked together. Networks are usually used to share resources, exchange files or communicate with other users. so A

Explanation:

7 0
2 years ago
What is a way to minimize techniacl problems with your computer.
Vsevolod [243]
Have you tried turning it off and back on.Try that if that does not work then try debugging it
3 0
4 years ago
Read 2 more answers
________________ is broad term used to describe the many web-based tools that enable computer-mediated interpersonal, group, and
icang [17]

Answer:

Social Media

Explanation:

4 0
4 years ago
Write a function isPrime of type int -&gt; bool that returns true if and only if its integer parameter is a prime number. Your f
PolarNik [594]

Answer:

import math

def isPrime(num):

 

   if num % 2 == 0 and num > 2:

       return False

   for i in range(3, int(math.sqrt(num)) + 1, 2):

       if num % i == 0:

           return False

   return True

Explanation:

The solution is provided in the python programming language, firstly the math class is imported so we can use the square root method. The first if statement checks if the number is even and greater than 2 and returns False since all even numbers except two are not prime numbers.

Then using a for loop on a range (3, int(math.sqrt(num)) + 1, 2), the checks if the number evenly divides through i and returns False otherwise it returns True

see code and output attached

5 0
4 years ago
Other questions:
  • The EPA requires the use of precise forms called ?
    14·1 answer
  • Why does the PC send out a broadcast ARP prior to sending the first ping request
    12·1 answer
  • What was the first carbonated drink to be introduced in the US?
    6·1 answer
  • Given an list of N integers, Insertion Sort will, for each element in the list starting from the second element: Compare the ele
    8·1 answer
  • To run a PHP application that has been deployed on your own computer you can enter a URL in the address bar of your browser that
    7·1 answer
  • How many people employed in the United States work in a job related to digital media?
    12·1 answer
  • Suppose you are an ad-serving company and you maintain a log of cookie data for ads you serve to the Web pages for a particular
    14·1 answer
  • Learning in a digital environment is also called [blank] learning.
    11·2 answers
  • Write the function greeting that takes a string as input. That string will be formatted as Name Age Hobby, without any punctuati
    14·1 answer
  • Jason is the motion picture projectionist at the local IMAX theater. This means that he runs the huge movie projector so that cu
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!